제출 #916725

#제출 시각아이디문제언어결과실행 시간메모리
916725andrei_iorgulescu콤보 (IOI18_combo)C++14
100 / 100
14 ms2052 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; string guess_sequence(int N) { char firstc; int x = press("AB"); if (x == 0) { int y = press("X"); if (y == 0) firstc = 'Y'; else firstc = 'X'; } else { int y = press("A"); if (y == 0) firstc = 'B'; else firstc = 'A'; } if (N == 1) { string ret; ret.push_back(firstc); return ret; } string restul; if (firstc == 'A') restul = "BXY"; else if (firstc == 'B') restul = "AXY"; else if (firstc == 'X') restul = "ABY"; else restul = "ABX"; string ans; ans.push_back(firstc); for (int i = 2; i < N; i++) { ///restul[0] deloc, restul[1] singur, restul[2] cu orice dupa string idfk; string s1,s2,s3,s4; s1 = ans + restul[1]; s2 = ans + restul[2] + restul[0]; s3 = ans + restul[2] + restul[1]; s4 = ans + restul[2] + restul[2]; idfk = s1 + s2 + s3 + s4; int idk = press(idfk); if (idk == ans.size()) ans.push_back(restul[0]); else if (idk == ans.size() + 1) ans.push_back(restul[1]); else ans.push_back(restul[2]); } for (int i = 0; i < 2; i++) { string idfk; idfk = ans + restul[i]; int idk = press(idfk); if (idk == N) return idfk; } string idfk = ans + restul[2]; return idfk; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:54:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   54 |         if (idk == ans.size())
      |             ~~~~^~~~~~~~~~~~~
combo.cpp:56:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |         else if (idk == ans.size() + 1)
      |                  ~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...