Submission #260607

#TimeUsernameProblemLanguageResultExecution timeMemory
260607Ahmadsm2005Combo (IOI18_combo)C++14
100 / 100
44 ms968 KiB
#include <bits/stdc++.h> #include"combo.h" //#define endl '\n' #define modulo 200003 #define PI acos(-1) #pragma GCC target ("avx2") #pragma GCC optimize("trapv") //#define int long long #define sinDegrees(x) sin((x) * PI / 180.0) #define cosDegrees(x) cos((x) * PI / 180.0) #define tanDegrees(x) tan((x) * PI / 180.0) #define atanDegrees(x) atan(x)* 180.0 / PI using namespace std; int power(int x,int y,int m) { if(y<0) return 0; int temp; if(y == 0) return 1; temp = (power(x, y/2,m))%m; if (y%2 == 0) return ((temp%m)*temp); else return ((x*temp%m)*temp%m)%m; } int inv(int x) { return (power(x,modulo-2,modulo))%modulo; } bool comp(int a,int b) { return a>b; } ///solution created by: Ahmadsm2005 /*int press(string s){ cout<<s<<endl; int ans; cin>>ans; return ans; }*/ string guess_sequence(int n){ vector<char>lolz; lolz.push_back('A'),lolz.push_back('B'),lolz.push_back('X'),lolz.push_back('Y'); n--; char S; string answer; bool counter=0; if(press("AB")){ if(press("A")) S='A'; else S='B'; } else if(press("X")) S='X'; else S='Y'; for(int i=0;i<4;i++) if(lolz[i]==S){ lolz.erase(lolz.begin()+i); break; } answer+=S; while(n--){ if(n){ string SS=answer,SS2=answer,SS3=answer,SS4=answer; SS+=lolz[0],SS2+=lolz[0],SS3+=lolz[0],SS4+=lolz[1],SS+=lolz[0],SS2+=lolz[1],SS3+=lolz[2]; string combined=SS+SS2+SS3+SS4; int ANS=press(combined); if(ANS==answer.size()) answer+=lolz[2]; else if(ANS==answer.size()+1) answer+=lolz[1]; else answer+=lolz[0]; } else if(press(answer+lolz[0])==answer.size()+1) answer+=lolz[0]; else if(press(answer+lolz[1])==answer.size()+1) answer+=lolz[1]; else answer+=lolz[2]; } return answer; } /*int32_t main() { //freopen("output.txt","w",stdout); //freopen("a3.in","r",stdin); //cin.tie(0),iostream::sync_with_stdio(0); guess_sequence(3); return 0; }*/

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:72:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   72 | if(ANS==answer.size())
      |    ~~~^~~~~~~~~~~~~~~
combo.cpp:74:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   74 | else if(ANS==answer.size()+1)
      |         ~~~^~~~~~~~~~~~~~~~~
combo.cpp:80:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   80 | if(press(answer+lolz[0])==answer.size()+1)
      |    ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
combo.cpp:82:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   82 | else if(press(answer+lolz[1])==answer.size()+1)
      |         ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
combo.cpp:48:6: warning: unused variable 'counter' [-Wunused-variable]
   48 | bool counter=0;
      |      ^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...