Submission #1127586

#TimeUsernameProblemLanguageResultExecution timeMemory
1127586byhtlmCombo (IOI18_combo)C++20
97 / 100
11 ms524 KiB
#include "combo.h" #include <bits/stdc++.h> #include <time.h> #define l long long using namespace std; string guess_sequence(int N){ l fs = 4; // A B X Y l k = rand()%10; map<l , string>m; m[1] = "A"; m[2] = "B"; m[3] = "X"; m[4] = "Y"; string s1 , s2 , s3; if(press("A") == 1){ fs = 1; s1 = "B"; s2 = "X"; s3 = "Y"; } else if(press("B") == 1){ fs = 2; s1 = "A"; s2 = "X"; s3 = "Y"; } else if(press("X") == 1){ fs = 3; s1 = "A"; s2 = "B"; s3 = "Y"; } else{ s1 = "A"; s2 = "B"; s3 = "X"; } string pre = m[fs]; if(N==1){ return pre; } //ABXYY => n1 = 3 // AB AXB AXX AXY // n + 2 - 3 = n - 1 // n - 1 => n - 1 //YX for(int i = 1; i < N - 1 ; i++){ string test = pre + s1 + pre + s2 + s1 + pre + s2 + s2 + pre + s2 + s3; l ans = press(test); //cout<<ans<<endl; if(ans == i + 1){ pre = pre + s1; } else if(ans == i + 2){ pre = pre + s2; } else{ pre = pre + s3; } } if(press(pre + s1) == N){ pre = pre + s1; } else if(press(pre + s2) == N){ pre = pre + s2; } else{ pre = pre + s3; } return pre; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...