#include<iostream> using namespace std; int MAX = 100000; int map1[MAX]; int map2[MAX]; int main(){ int t, blank; cin >> t; for(int i = 0; i < t; ++i){ int n; cin >> n; for(int j = 0; j < n; j++){ int a,b; char c; cin >> a >> c >> b; map1[a] = b; map2[b] = a; } int m; cin >> m; for(int j = 0; j < m; j++){ int q; cin >> q; if(map1[q] != 0){ cout << map1[q] << endl; }else if(map2[q] != 0){ cout << map2[q] << endl; }else{ cout << "UNKNOW" << endl; } } cout << endl; } return 0; } /* Main.cc:5:13: error: array bound is not an integer constant before ']' token int map1[MAX]; ^ Main.cc:6:13: error: array bound is not an integer constant before ']' token int map2[MAX]; ^ Main.cc: In function 'int main()': Main.cc:18:8: error: 'map1' was not declared in this scope map1[a] = b; ^~~~ Main.cc:18:8: note: suggested alternative: 'main' map1[a] = b; ^~~~ main Main.cc:19:8: error: 'map2' was not declared in this scope map2[b] = a; ^~~~ Main.cc:19:8: note: suggested alternative: 'main' map2[b] = a; ^~~~ main Main.cc:26:11: error: 'map1' was not declared in this scope if(map1[q] != 0){ ^~~~ Main.cc:26:11: note: suggested alternative: 'main' if(map1[q] != 0){ ^~~~ main Main.cc:28:15: error: 'map2' was not declared in this scope }else if(map2[q] != 0){ ^~~~ Main.cc:28:15: note: suggested alternative: 'main' }else if(map2[q] != 0){ ^~~~ main Main.cc:9:10: warning: unused variable 'blank' [-Wunused-variable] int t, blank; ^~~~~ */ |
Double click to view unformatted code.