제출 #605571

#제출 시각아이디문제언어결과실행 시간메모리
605571Clan328콤보 (IOI18_combo)C++17
5 / 100
1 ms252 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back int press(std::string p); string guess_sequence(int N) { // Guess first letter string s = ""; if (press("AB") > 0) { if (press("A") > 0) s += 'A'; else s += 'B'; } else { if (press("X") > 0) s += 'X'; else s += 'Y'; } vector<string> letters; if (s[0] != 'A') letters.pb("A"); if (s[0] != 'B') letters.pb("B"); if (s[0] != 'X') letters.pb("X"); if (s[0] != 'Y') letters.pb("Y"); letters.pb(""); letters[3] += s[0]; for (int i = 1; i < N-1; i++) { string q = s + letters[0]+letters[1] + s+ letters[0]+letters[2] + s+letters[0]+letters[0] + s +letters[1]; int ans = press(q); if (ans == s.size()) s += letters[2]; else if (ans == s.size()+1) s += letters[1]; else s += letters[0]; } if (press(s+letters[0]) > s.size()) s += letters[0]; else if (press(s+letters[1]) > s.size()) s+= letters[1]; else s+=letters[2]; return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:32:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |   if (ans == s.size()) s += letters[2];
      |       ~~~~^~~~~~~~~~~
combo.cpp:33:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |   else if (ans == s.size()+1) s += letters[1];
      |            ~~~~^~~~~~~~~~~~~
combo.cpp:37:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |  if (press(s+letters[0]) > s.size()) s += letters[0];
      |      ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
combo.cpp:38:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |  else if (press(s+letters[1]) > s.size()) s+= letters[1];
      |           ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...