제출 #542648

#제출 시각아이디문제언어결과실행 시간메모리
542648RaresFelix콤보 (IOI18_combo)C++17
5 / 100
1 ms208 KiB
#include "combo.h" using namespace std; #include <set> std::string guess_sequence(int N) { /*std::string p = ""; for (int i = 0; i < 4 * N; ++i) { p += 'A'; } int coins = press(p); std::string S = ""; for (int i = 0; i < N; ++i) { S += 'A'; }*/ string incep_char; if(press("AB")) incep_char = press("A") ? "A" : "B"; else incep_char = press("X") ? "X" : "Y"; string cguess = incep_char; set<string> Posib{"A", "B", "X", "Y"}; Posib.erase(incep_char); string A, B, C; A = *Posib.begin(); Posib.erase(A); B = *Posib.begin(); Posib.erase(B); C = *Posib.begin(); Posib.erase(C); for(int i = 1; i < N - 1; ++i) { int rasp = press(cguess + A + A + cguess + A + B + cguess + A + C + cguess + B); if(rasp == cguess.size() + 2) cguess += A; else if(rasp == cguess.size() + 1) cguess += B; else cguess += C; } if(press(cguess + A) == N) return cguess + A; if(press(cguess + B) == N) return cguess + B; return cguess + C; }

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

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