제출 #900140

#제출 시각아이디문제언어결과실행 시간메모리
900140Omar_Elgedawy콤보 (IOI18_combo)C++14
100 / 100
11 ms2044 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; mt19937 mt(time(nullptr)); string guess_sequence(int n) { vector<char> chr(3); string cur; if(press("AB")){ if(press("A")){ cur="A"; chr={'B','X','Y'}; } else{ cur="B"; chr={'A','X','Y'}; } } else{ if(press("X")){ cur="X"; chr={'B','A','Y'}; } else{ cur="Y"; chr={'A','X','B'}; } } for (int i = 1; i < n-1; i++) { // cout<<cur+chr[0]+chr[0]+cur+chr[0]+chr[1]+cur+chr[0]+chr[2]+cur+chr[1]<<endl; int len=press(cur+chr[0]+chr[0]+cur+chr[0]+chr[1]+cur+chr[0]+chr[2]+cur+chr[1]); if(len==cur.size())cur+=chr[2]; else if(len==cur.size()+2)cur+=chr[0]; else cur+=chr[1]; } if(n>1){ if(press(cur+chr[0])==cur.size()+1)cur+=chr[0]; else if(press(cur+chr[1])==cur.size()+1)cur+=chr[1]; else cur+=chr[2]; } // cout<<cur<<endl; return cur; }

컴파일 시 표준 에러 (stderr) 메시지

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:33:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |         if(len==cur.size())cur+=chr[2];
      |            ~~~^~~~~~~~~~~~
combo.cpp:34:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |         else if(len==cur.size()+2)cur+=chr[0];
      |                 ~~~^~~~~~~~~~~~~~
combo.cpp:38:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |         if(press(cur+chr[0])==cur.size()+1)cur+=chr[0];
      |            ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
combo.cpp:39:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |         else if(press(cur+chr[1])==cur.size()+1)cur+=chr[1];
      |                 ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...