Submission #405973

#TimeUsernameProblemLanguageResultExecution timeMemory
405973Magnam_CaritatemCombo (IOI18_combo)C++14
0 / 100
1 ms276 KiB
/* Task : combo Author : Phumipat C. [MAGCARI] Language: C++ Created : 17 May 2021 [12:41] Algo : Status : */ #include<bits/stdc++.h> #define rep(i, a, b) for(int i = a; i < (b); ++i) #define all(x) begin(x),end(x) #define allst(x,y) (x).begin()+y,(x).end() #define rmdup(x) (x).resize(unique((x).begin(),(x).end())-(x).begin()) #define sz(x) (int)(x).size() #define decp(x) fixed << setprecision(x) #define MOD (LL )(1e9+7) using namespace std; using LL = long long; using PII = pair<int ,int >; using PLL = pair<long long ,long long >; const int dir4[2][4] = {{1,-1,0,0},{0,0,1,-1}}; const int dir8[2][8] = {{-1,-1,-1,0,1,1,1,0},{-1,0,1,1,-1,0,1,-1}}; LL modN(LL a,LL b,LL c = MOD){ if(b == 0) return 1; if(b == 1) return a%c; LL now = modN(a,b/2,c); if(b&1) return (((now*now)%c)*(a%c))%c; else return (now*now)%c; } #include "combo.h" std::string guess_sequence(int N) { vector<char > c(4); vector<char >::iterator it; c = {'A','B','X','Y'}; char last = 'Y'; it = c.begin(); int ret = 0; string now; c.pop_back(); now.push_back('0'); for(auto x:c){ now.back() = x; ret = press(now); if(ret){ c.erase(it); break; } it++; } if(!ret) now.back() = last; last = c.back(); c.pop_back(); rep(i,2,N+1){ now.push_back('0'); for(auto x:c){ now.back() = x; ret = press(now); if(ret == i) break; } if(ret!=i) now.back() = last; } // cout << now << '\n'; return now; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...