제출 #1057427

#제출 시각아이디문제언어결과실행 시간메모리
1057427ender콤보 (IOI18_combo)C++17
0 / 100
1 ms344 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; std::string guess_sequence(int N) { vector<char> c = {'A', 'B', 'X', 'Y'}; string s = ""; int coins = 0; for(int i = 0; i < 4; ++i){ if(i == 3){ s += c[i]; c.erase(c.begin() + i); coins = 1; break; } if(press(s+c[i]) > coins){ s += c[i]; c.erase(c.begin() + i); coins = 1; break; } } while(coins != N){ cout << s << " 0" << "\n"; vector<string> cs(3); string p = ""; for(int i = 0; i < 3; ++i){ cs[i] = s + c[i]; if(cs[i].size() == N) { cs[i] += cs[i]; continue; } cs[i] += (c[0] + cs[i] + c[1]); cout << cs[i] << "\n"; } for(auto &i : cs){ cout << i << "\n"; int cur = press(i); if(cur == coins + 1){ if(i.size()/2 == N){ s += i[i.size()-1]; coins++; break; } s += i[i.size()-2]; s += c[2]; coins += 2; break; } else if (cur == coins + 2){ string subcur = i.substr(0, N); if(press(subcur) == cur) { s += subcur.substr(N-2, 2); coins += 2; break; } else { s += i.substr(i.size() - 2, 2); coins += 2; break; } } } } cout << s << "\n"; return s; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:44:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   44 |       if(cs[i].size() == N) {
      |          ~~~~~~~~~~~~~^~~~
combo.cpp:63:23: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   63 |         if(i.size()/2 == N){
      |            ~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...