제출 #587815

#제출 시각아이디문제언어결과실행 시간메모리
587815IvanJ콤보 (IOI18_combo)C++17
5 / 100
1 ms464 KiB
#include "combo.h" #include<bits/stdc++.h> #define all(a) (a).begin(), (a).end() using namespace std; string guess_sequence(int n) { string p = "", s = ""; if(press("A")) s = "A"; else if(press("B")) s = "B"; else if(press("X")) s = "X"; else s = "Y"; set<string> S; S.insert("A"), S.insert("B"), S.insert("X"), S.insert("Y"); S.erase(s); vector<string> v(all(S)); for(int i = 1;i < n - 1;i++) { p = s + v[0]; for(int j = 0;j < 3;j++) p += s + v[1] + v[j]; int x = press(p); if(x == (int)s.size() + 1) s += v[0]; else if(x == (int)s.size() + 2) s += v[1]; else s += v[2]; } assert(s.size() == n - 1); if(press(s + v[0]) == n) s += v[0]; else if(press(s + v[1]) == n) s += v[1]; else s += v[2]; return s; }

컴파일 시 표준 에러 (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:29:18: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   29 |  assert(s.size() == n - 1);
      |         ~~~~~~~~~^~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...