Submission #534525

#TimeUsernameProblemLanguageResultExecution timeMemory
534525Abdulmohsen1284콤보 (IOI18_combo)C++14
Compilation error
0 ms0 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { string g,s; g="AB"; long long ans=press(g); if(ans==1) { g="A"; ans=press(g); if(ans==1) s="A"; else s="B"; } else { g="X"; ans=press(g); if(ans==1) s="X"; else s="Y"; } char a[4]; long long cur=0; string chek="ABXY"; for(int i=0;i<chek.size();i++) { if(s[0]!=chek[i]) { a[cur]=chek[i]; cur++; } } for(int i=1;i<N-1;i++) { string rn; rn=s+chek[0]; for(int j=0;j<3;j++) rn+=s+check[1]+chek[j]; ans=press(rn); if(ans==s.size()) { s+=chek[2]; } if(ans==s.size()+1) { s+=chek[0]; } if(ans==s.size()+2) { s+=chek[1]; } } if(N!=1) { string rn=s+"A"+s+"B"; ans=press(rn); if(ans==s.size()+1) { rn=s+"A"; ans=press(rn); if(ans==s.size()+1) s+="A"; else s+="B"; } else { rn=s+"X"; ans=press(rn); if(ans==s.size()+1) s+="X"; else s+="Y"; } } return s; }

Compilation message (stderr)

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:29:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     for(int i=0;i<chek.size();i++)
      |                 ~^~~~~~~~~~~~
combo.cpp:42:19: error: 'check' was not declared in this scope; did you mean 'chek'?
   42 |             rn+=s+check[1]+chek[j];
      |                   ^~~~~
      |                   chek
combo.cpp:44:15: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |         if(ans==s.size())
      |            ~~~^~~~~~~~~~
combo.cpp:48:15: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |         if(ans==s.size()+1)
      |            ~~~^~~~~~~~~~~~
combo.cpp:52:15: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |         if(ans==s.size()+2)
      |            ~~~^~~~~~~~~~~~
combo.cpp:61:15: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   61 |         if(ans==s.size()+1)
      |            ~~~^~~~~~~~~~~~
combo.cpp:65:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |             if(ans==s.size()+1)
      |                ~~~^~~~~~~~~~~~
combo.cpp:74:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   74 |             if(ans==s.size()+1)
      |                ~~~^~~~~~~~~~~~