제출 #113491

#제출 시각아이디문제언어결과실행 시간메모리
113491Mamnoon_Siam콤보 (IOI18_combo)C++17
5 / 100
2 ms256 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string ret; set<char> r; r.insert('A'); r.insert('B'); r.insert('X'); r.insert('Y'); if(press("A")) ret += "A", r.erase('A'); else if(press("B")) ret += "B", r.erase('B'); else if(press("X")) ret += "X", r.erase('X'); else ret += "Y", r.erase('Y'); vector<int> R(r.begin(), r.end()); for(int i = 2; i < N; i++) { string tmp; tmp += ret; tmp += R[0]; for(char ch : R) { tmp += ret; tmp += R[1]; tmp += ch; } int rep = press(tmp); if(rep == ret.size()) ret += R[2]; else if(rep == ret.size() + 1) ret += R[0]; else ret += R[1]; } for(int k = 0; k < 2; k++) { char ch = R[k]; string tmp = ret; tmp += ch; if(press(tmp) == N) { ret += ch; break; } } if(ret.size() != N) { ret += R[2]; } return ret; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:27:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |         if(rep == ret.size()) ret += R[2];
      |            ~~~~^~~~~~~~~~~~~
combo.cpp:28:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |         else if(rep == ret.size() + 1) ret += R[0];
      |                 ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:40:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   40 |     if(ret.size() != N) {
      |        ~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...