Submission #1300274

#TimeUsernameProblemLanguageResultExecution timeMemory
1300274AgageldiCombo (IOI18_combo)C++20
Compilation error
0 ms0 KiB
#include "bits/stdc++.h" #include "combo.h" // #include "grader.cpp" using namespace std; int vis[50]; vector <char> v = {'A', 'B', 'X', 'Y'}; string find_f(string g) { int nd = press(g); if(nd == 1) { string h = ""; nd = press(h + g[0]); if(nd == 1) return h + g[0]; else return h + g[1]; } if(nd == 0) { string h = ""; int cnt = 0; for(auto i : v) { cnt++; if(i == g[0] || i == g[1]) continue; if(cnt == 4) return h + i; nd = press(h + i); if(nd) return h + i; } } return g; } string guess_sequence(int N) { string S = find_f("AB"), h = ""; for(auto i : v) { if(i != S[0]) h += i; } while(1) { string g = S; for(int i = 0; i <= 2; i++) { g += h[0]; g += h[i]; g += S; } g += h[2]; if((int)g.size() > N * 4) break; int nd = press(g); if(nd == (int)S.size() + 1) { S += h[2]; } else if(nd == (int)S.size() + 2) { S += h[0]; } else { S += h[1]; } } if((int)S.size() == N) return S; int c = 0; for(auto i : h) { c++; if(c == 3) return S + i; int nd = press(S + i); if(nd == (int)S.size() + 1) return S + i; } return S; } #include "bits/stdc++.h" #include "combo.h" #include "grader.cpp" using namespace std; int vis[50]; vector <char> v = {'A', 'B', 'X', 'Y'}; string find_f(string g) { int nd = press(g); if(nd == 1) { string h = ""; nd = press(h + g[0]); if(nd == 1) return h + g[0]; else return h + g[1]; } if(nd == 0) { string h = ""; int cnt = 0; for(auto i : v) { cnt++; if(i == g[0] || i == g[1]) continue; if(cnt == 4) return h + i; nd = press(h + i); if(nd) return h + i; } } return g; } string guess_sequence(int N) { string S = find_f("AB"), h = ""; for(auto i : v) { if(i != S[0]) h += i; } while(1) { string g = S; for(int i = 0; i <= 2; i++) { g += h[0]; g += h[i]; g += S; } g += h[2]; if((int)g.size() > N * 4) break; int nd = press(g); if(nd == (int)S.size() + 1) { S += h[2]; } else if(nd == (int)S.size() + 2) { S += h[0]; } else { S += h[1]; } } if((int)S.size() == N) return S; int c = 0; for(auto i : h) { c++; if(c == 3) return S + i; int nd = press(S + i); if(nd == (int)S.size() + 1) return S + i; } return S; }

Compilation message (stderr)

combo.cpp:72:5: error: redefinition of 'int vis [50]'
   72 | int vis[50];
      |     ^~~
combo.cpp:6:5: note: 'int vis [50]' previously declared here
    6 | int vis[50];
      |     ^~~
combo.cpp:73:15: error: redefinition of 'std::vector<char> v'
   73 | vector <char> v = {'A', 'B', 'X', 'Y'};
      |               ^
combo.cpp:7:15: note: 'std::vector<char> v' previously declared here
    7 | vector <char> v = {'A', 'B', 'X', 'Y'};
      |               ^
combo.cpp:74:8: error: redefinition of 'std::string find_f(std::string)'
   74 | string find_f(string g) {
      |        ^~~~~~
combo.cpp:8:8: note: 'std::string find_f(std::string)' previously defined here
    8 | string find_f(string g) {
      |        ^~~~~~
combo.cpp:96:8: error: redefinition of 'std::string guess_sequence(int)'
   96 | string guess_sequence(int N) {
      |        ^~~~~~~~~~~~~~
combo.cpp:30:8: note: 'std::string guess_sequence(int)' previously defined here
   30 | string guess_sequence(int N) {
      |        ^~~~~~~~~~~~~~