Submission #1205920

#TimeUsernameProblemLanguageResultExecution timeMemory
1205920Adeeb_obedoCombo (IOI18_combo)C++20
100 / 100
7 ms484 KiB
#include<bits/stdc++.h> #define int long long #define ld double #define _1 first #define _2 second #define yes cout<<"Yes\n" #define nah cout<<"No\n" #define FFF ios_base::sync_with_stdio(0);cin.tie(0); #define ipr pair<int,int> #define ret return #define intt int32_t #define mid ((l+r)/2) #define pb push_back #define lll __int128 #include "combo.h" using namespace std; int tst, ts; intt mo = 1e9+7, dx[] = {0, 1, 0, -1}, dy[] = {-1, 0, 1, 0}; int mul( int x, int y ) { ret ( ( x % mo ) * ( y % mo ) ) % mo; ret x*y; } int pwo( int x, int y ) { int res = 1; for( int i = 63; i + 1; i-- ) res = mul( res, res * ( ( 1ll << i )&y ? x : 1 ) ); ret res; } int dvii( int x, int y ) { ret mul( x, pwo( y, mo - 2 ) ); } int oo( char x ) { ret ( int )x - '0'; } int lgg( int x, int y ) { int u = 0; while( x ) { u++; x /= y; } ret u; } int mun( int x, int y ) { while( x < y )x += mo; ret ( x - y ) % mo; } int add( int x, int y ) { ret x + y - ( mo * ( x + y >= mo ) ); ret x + y; } int lcm( int x, int y ) { ret ( x * y ) / __gcd( x, y ); } #define endl '\n'; const int M =1007, N = 2e5 + 7, N2 = 5e3 + 7, inf = 2e18 + 7; string guess_sequence(intt n){ string s="",x="ABXY"; if(press("AB")) s+=(press("A")?'A':'B'); else s+=(press("X")?'X':'Y'); for(int i=0;i<4;i++) if(x[i]==s[0]) swap(x[i],x[3]); x.pop_back(); for(int i=1;i<n-1;i++){ string p=""; p+=s;p+=x[0]; p+=s;p+=x[1];p+=x[0]; p+=s;p+=x[1];p+=x[1]; p+=s;p+=x[1];p+=x[2]; int o=press(p)-s.size(); //cout<<o<<" "<<y<<endl; if(o==0) s+=x[2]; else if(o==1) s+=x[0]; else s+=x[1]; } if(n==1) ret s; string p=s; p+=x[0]; p+=s;p+=x[1]; if(press(p)==n) s+=((press(s+x[0])==n)?x[0]:x[1]); else s+=x[2]; // cout<<n<<" "<<endl; ret s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...