제출 #600553

#제출 시각아이디문제언어결과실행 시간메모리
600553Belgutei콤보 (IOI18_combo)C++17
100 / 100
37 ms608 KiB
#include "combo.h" #include<bits/stdc++.h> using namespace std; char a[9]; string p,s; void g(char ch) { int cnt = 0; s += ch; if(ch != 'A') { a[cnt] = 'A'; cnt ++; } if(ch != 'B') { a[cnt] = 'B'; cnt ++; } if(ch != 'X') { a[cnt] = 'X'; cnt ++; } if(ch != 'Y') { a[cnt] = 'Y'; cnt ++; } } std::string guess_sequence(int N) { int c = press("AB"); if(c == 2) { s += p; g('A'); } else if(c == 1) { c = press("A"); if(c == 1) g('A'); else g('B'); } else { if(press("X") == 1) g('X'); else g('Y'); } if(s.size() == N) return s; for(int i = s.size() + 1; i < N; i ++) { p = s + a[0] + a[1] + s + a[0] + a[2] + s + a[0] + a[0] + s + a[1]; c = press(p); if(c == s.size() + 2) s += a[0]; else if(c == s.size() + 1) s += a[1]; else s += a[2]; } p = s + a[0]; if(press(p) == N) return p; p = s + a[1]; if(press(p) == N) return p; p = s + a[2]; return p; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:31:15: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   31 |   if(s.size() == N) return s;
      |      ~~~~~~~~~^~~~
combo.cpp:35:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |     if(c == s.size() + 2) s += a[0];
      |        ~~^~~~~~~~~~~~~~~
combo.cpp:36:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |     else if(c == s.size() + 1) s += a[1];
      |             ~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...