Submission #132002

#TimeUsernameProblemLanguageResultExecution timeMemory
132002dvdg6566Combo (IOI18_combo)C++14
0 / 100
2 ms456 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; #define pb emplace_back #define mp make_pair #define ALL(x) x.begin(), x.end() #define SZ(x) (int)x.size() char ltrs[] = {'A', 'B', 'X', 'Y'}; vector<char> res; string guess_sequence(int N) { // cres<<N<<'\n'; int a = press("AB"); int b = press("AX"); int x; if(a&&b)res.pb('A'); if (a&&!b)res.pb('B'); if (!a&&b)res.pb('X'); if(!a&&!b)res.pb('Y'); vector<char> V; for (int i=0;i<4;++i)if(ltrs[i] != res[0])V.pb(ltrs[i]); for (x=2;x<N;++x){ string q = ""; for (auto i : res)q+=i; q += V[0]; q += V[0]; for (auto i : res)q+=i; q += V[0]; q += V[1]; for (auto i : res)q+=i; q += V[0]; q += V[2]; for (auto i : res)q+=i; q += V[1]; assert(SZ(q) <= 4*N); for (auto i : q)assert(i=='A'||i=='B'||i=='X'||i=='Y'); // cres<<q<<'\n';4 int r = press(q); // cres<<res<<' '<<x<<'\n'; if (r == x-1){ res.pb(V[2]); }else if (r == x+1){ res.pb(V[0]); }else{ res.pb(V[1]); } } assert(x<N); string ret = ""; for (auto i : res)ret += i; ret += V[0]; if (press(ret) == N)return ret; ret = ""; for (auto i : res)ret += i; ret += V[1]; if (press(ret) == N)return ret; ret = ""; for (auto i : res)ret += i; ret += V[2]; if (press(ret) == N)return ret; assert(0); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...