제출 #716603

#제출 시각아이디문제언어결과실행 시간메모리
716603TahirAliyev콤보 (IOI18_combo)C++17
100 / 100
32 ms568 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; string guess_sequence(int N) { string ans = ""; if(press("AB")){ if(press("A")){ ans += 'A'; } else{ ans += 'B'; } } else{ if(press("X")){ ans += 'X'; } else{ ans += 'Y'; } } if(N == 1) return ans; vector<char> v = {'A', 'B', 'X', 'Y'}; v.erase(find(v.begin(), v.end(), ans[0])); for (int i = 0; i < N - 2; i++) { string help = ""; help += ans; help += v[0]; for (int j = 0; j < 3; j++) { help += ans; help += v[1]; help += v[j]; } int coins = press(help); if(coins == ans.size() + 1){ ans += v[0]; } else if(coins == ans.size() + 2){ ans += v[1]; } else{ ans += v[2]; } } if(press(ans + v[0]) == N){ ans += v[0]; }else if(press(ans + v[1]) == N){ ans += v[1]; } else{ ans += v[2]; } return ans; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:40:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |         if(coins == ans.size() + 1){
      |            ~~~~~~^~~~~~~~~~~~~~~~~
combo.cpp:43:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |         else if(coins == ans.size() + 2){
      |                 ~~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...