Submission #1034341

#TimeUsernameProblemLanguageResultExecution timeMemory
1034341vjudge1Combo (IOI18_combo)C++17
30 / 100
40 ms952 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define fst first #define snd second #define pb push_back #define forn(i,a,b) for(int i = a; i < b; i++) #define ALL(x) x.begin(),x.end() #define SZ(x) (int)x.size() #define mset(a,v) memset((a),(v),sizeof(a)) #define FIN ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define dbg(v) cout<<"Line("<<__LINE__<<"): "<<#v<<" = "<<v<<'\n'; #define pi pair<int,int> #define pll pair<ll,ll> typedef long long ll; using namespace std; using namespace __gnu_pbds; typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set; typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_multiset; /* #include "combo.h" const int MAXC = 4; char chars[MAXC]; std::string guess_sequence(int N) { chars[0]='A'; chars[1]='B'; chars[2]='X'; chars[3]='Y'; string aux; char fChar; forn(i,0,MAXC){ aux=""; aux+=chars[i]; if(press(aux)){ fChar=chars[i]; break; } } string res = ""; res+=fChar; forn(i,1,N){ forn(j,0,MAXC) if(chars[j]!=fChar){ if(press(res+chars[j])==i+1){ res+=chars[j]; break; } } } return res; } */ #include "combo.h" const int MAXC = 4; char chars[MAXC]; std::string guess_sequence(int N) { chars[0]='A'; chars[1]='B'; chars[2]='X'; chars[3]='Y'; string aux; string res = ""; forn(i,0,N){ aux = res; aux+=chars[0]; aux+=res; aux+=chars[1]; //cout<<aux<<'\n'; if(press(aux)>=i+1){ aux = res; aux+=chars[0]; //cout<<aux<<'\n'; if(press(aux)>=i+1){ res+=chars[0]; }else{ res+=chars[1]; } }else{ aux = res; aux+=chars[2]; //cout<<aux<<'\n'; if(press(aux)>=i+1){ res+=chars[2]; }else{ res+=chars[3]; } } } //cout<<res<<'\n'; return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...