제출 #468108

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

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:70:17: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   70 |   if(s.length() < N)
      |      ~~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...