Submission #1305230

#TimeUsernameProblemLanguageResultExecution timeMemory
1305230iamsazidhCombo (IOI18_combo)C++20
100 / 100
8 ms476 KiB
#include "combo.h" //ᴇᴀᴄʜ ᴘᴇʀꜱᴏɴ ᴡɪʟʟ ᴏɴʟʏ ʜᴀᴠᴇ ᴡʜᴀᴛ ᴛʜᴇʏ ᴇɴᴅᴇᴀᴠᴏᴜʀᴇᴅ ᴛᴏᴡᴀʀᴅꜱ [53:39] //Author: Sazid Hasan #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef double dl; typedef vector<int> vi; typedef vector<vector<int>> vii; typedef vector<ll> vl; typedef vector<bool> vb; typedef pair<int,int> pii; typedef pair<ll, ll> pll; #define ff first #define ss second #define all(a) a.begin(),a.end() #define gcd(a,b) __gcd(a,b) #define lcm(a,b) (a*(b/gcd(a,b))) #define spc " " #ifdef ONLINE_JUDGE #define debarr(array) #define deb(x) #define del #else #define debarr(array) for(int w = 0; w < array.size(); w++) cerr << #array << "-" << w << " = " << array[w] << endl; #define deb(x) cerr << #x << " = " << x << endl; #define del cerr << '\n'; #endif const double PI = acos(-1); const int MOD = 1000000007; const int inf = (2147483647); std::string guess_sequence(int N) { string s = ""; vector<char> ch = {'A', 'B', 'X', 'Y'}; int now = press("AB"); if(now>0){ now = press("A"); if(now==1) s = "A"; else s = "B"; }else{ now = press("X"); if(now==1) s = "X"; else s = "Y"; } auto itr = find(all(ch), s[0]); ch.erase(itr); for(int i = 1; i < N-1; i++){ now = press(s+ch[0] + s+ch[1]+ch[0] + s+ch[1]+ch[1] + s+ch[1]+ch[2]); if(now==1+i) s.push_back(ch[0]); else if(now==2+i) s.push_back(ch[1]); else s.push_back(ch[2]); } if(N!=1){ now = press(s+ch[0] + s+ch[1]); if(now==s.size()) s.push_back(ch[2]); else{ now = press(s+ch[0]); if(now==s.size()) s.push_back(ch[1]); else s.push_back(ch[0]); } } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...