Submission #138191

#TimeUsernameProblemLanguageResultExecution timeMemory
138191wmrmrCombo (IOI18_combo)C++17
30 / 100
100 ms420 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; // int press(string p) int n,cur; string ans, x; map<char,int> m; char v[] = {'A','B','X','Y'}; // AA AB AC BA BB BC CA CB CC // int delta(string s) { return ( press(s) - cur ); } void BuildMap() { m.insert({'A',0}); m.insert({'B',1}); m.insert({'X',2}); m.insert({'Y',3}); return; } void FirstLetter() { if( delta( "AB" ) ) { if( delta( "A" ) ) ans.push_back('A'); else ans.push_back('B'); } else { if( delta( "X" ) ) ans.push_back('X'); else ans.push_back('Y'); } cur++; return; } void AddSingle() { if( delta( ans + x[0] ) ) { ans.push_back(x[0]); } else { if( delta( ans + x[1]) ) ans.push_back(x[1]); else ans.push_back(x[2]); } cur++; return; } string guess_sequence(int N) { FirstLetter(); n = N; for(int i=0;i<4;i++) { if(v[i] == ans[0]) continue; x.push_back(v[i]); } while(cur < n) AddSingle(); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...