제출 #300045

#제출 시각아이디문제언어결과실행 시간메모리
300045MasterTaster콤보 (IOI18_combo)C++14
100 / 100
44 ms784 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { if (N==1) { int koliko=press("AB"); if (koliko) { if (press("A")) return "A"; else return "B"; } else { if (press("X")) return "X"; else return "Y"; } } int koliko=press("AB"); char prvi, a, b, c; if (koliko==2) { prvi='A'; a='B'; b='X'; c='Y'; } else if (koliko==1) { if (press("A")) { prvi='A'; a='B'; b='X'; c='Y'; } else { prvi='B'; a='A'; b='X'; c='Y'; } } else { if (press("X")) { prvi='X'; a='A'; b='B'; c='Y'; } else { prvi='Y'; a='A'; b='B'; c='X'; } } string s, p; s=p=""; s+=prvi; for (int i=1; i<N-1; i++) { p=(s+a+a)+(s+a+b)+(s+a+c)+(s+b); int koliko=press(p); if (koliko==s.size()) s+=c; else if (koliko==s.size()+1) s+=b; else s+=a; } koliko=press(s+a+s+b); if (koliko==s.size()) s+=c; else { koliko=press(s+a); if (koliko==s.size()) s+=b; else s+=a; } return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:64:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   64 |         if (koliko==s.size())
      |             ~~~~~~^~~~~~~~~~
combo.cpp:66:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   66 |         else if (koliko==s.size()+1)
      |                  ~~~~~~^~~~~~~~~~~~
combo.cpp:73:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   73 |     if (koliko==s.size()) s+=c;
      |         ~~~~~~^~~~~~~~~~
combo.cpp:77:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   77 |         if (koliko==s.size())
      |             ~~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...