제출 #647636

#제출 시각아이디문제언어결과실행 시간메모리
647636Truitadepatates콤보 (IOI18_combo)C++14
0 / 100
30 ms488 KiB
#include <bits/stdc++.h> #include "combo.h" using namespace std; const int M = 4; const char A[] = "ABXY"; int guess_one(const string& s) { int len = press(s + A[0] + s + A[1]); int idx = 2*(len < s.length()+1); len = press(s + A[idx]); idx += (len < s.length()+1); return idx; } string guess_sequence(int N) { int idx[M]; for (int i = 0; i < M; i++) { idx[i] = i; } string s; int id = guess_one(s); s += A[id]; //swap(idx[id], idx[M-1]); for (int i = 0; i < N-2; i++) { string z; for (int j = 0; j < M-1; j++) { z += s + A[idx[0]] + A[idx[j]]; } z += s + A[idx[1]]; int len = press(z); if (len == i+3) { s += A[idx[0]]; } else if (len == i+2) { s += A[idx[1]]; } else { s += A[idx[2]]; } } if (N > 1) { int id = guess_one(s); s += A[id]; } return s; }

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

combo.cpp: In function 'int guess_one(const string&)':
combo.cpp:10:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |   int idx = 2*(len < s.length()+1);
      |                ~~~~^~~~~~~~~~~~~~
combo.cpp:12:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |   idx += (len < s.length()+1);
      |           ~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...