Submission #258847

#TimeUsernameProblemLanguageResultExecution timeMemory
258847iliccmarkoCombo (IOI18_combo)C++14
0 / 100
1 ms200 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; std::string guess_sequence(int n) { string p; int l = 0; int ind[n]; for(int i = 0;i<n;i++) ind[i] = 0; char arr[] = {'A', 'B', 'X', 'Y'}; int sum = 0; int maks = 0; while(sum<n+2) { if(l==n) break; sum++; if((int)p.size() == 0) { p.push_back('A'); ind[0] = 0; l = press(p); continue; } char poc = p[0]; if(sum<=n) { int i = 0; while(arr[i] == poc) { i++; } ind[sum] = i; p.push_back(arr[i]); } for(int j = l;j<(int)p.size()-1;j++) { int i = ind[j] + 1; if(i==4) i = 0; while(arr[i] == poc) { i++; } ind[j] = i; p[j] = arr[i]; } if(maks&&sum>=n) { int i = ind[n-1] + 1; if(i==4) i = 0; while(arr[i] == poc) { i++; } ind[n-1] = i; p[n-1] = arr[i]; } if(sum==n) maks++; l = press(p); } return p; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...