제출 #597156

#제출 시각아이디문제언어결과실행 시간메모리
597156franfill콤보 (IOI18_combo)C++17
5 / 100
1 ms208 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { string s; if (press("AB")) if (press("A")) s = "A"; else s = "B"; else if (press("X")) s = "X"; else s = "Y"; string temp = "ABXY"; string pos = ""; for (auto c : temp) if (c != s[0]) pos += c; for (int i = 1; i < N-1; i++) { int l = s.size(); string q = s + pos[0]; for (auto c : pos) q += s + pos[1] + c; assert(q.size() <= N*4); int r = press(q); if (r == l+1) s += pos[0]; else if (r == l+2) s += pos[1]; else s += pos[2]; } int i; for (i = 0; i < 2; i++) if (press(s + pos[i]) == N) break; return s + pos[i]; }

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

In file included from /usr/include/c++/10/cassert:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
                 from combo.cpp:2:
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:23:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   23 |   assert(q.size() <= N*4);
      |          ~~~~~~~~~^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...