제출 #110057

#제출 시각아이디문제언어결과실행 시간메모리
110057DystoriaX콤보 (IOI18_combo)C++14
0 / 100
2 ms200 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; char c[] = {'A', 'B', 'X', 'Y'}; char f[3]; char k; string guess_sequence(int N) { string p = ""; //Find first character int coins = press("AB"); if(coins == 2) k = 'A'; else if (coins == 1) k = 'B'; else { coins = press("XY"); if(coins == 2) k = 'X'; else k = 'Y'; } p += k; int x = 0; for(int i = 0; i < 4; i++){ if(c[i] == k) continue; f[x++] = c[i]; } for(int i = 1; i < N - 1; i++){ string tp = ""; tp += p + f[0]; for(int j = 0; j < 3; j++) tp += p + f[1] + f[j]; coins = press(tp); if(coins == i) p += f[2]; else if (coins == i + 1) p += f[0]; else p += f[1]; } for(int i = 0; i < 2; i++){ coins = press(p + f[i]); if(coins == N){ p += f[i]; break; } } if(p.size() < N) p += f[2]; return p; }

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

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