제출 #823630

#제출 시각아이디문제언어결과실행 시간메모리
823630SoulKnight콤보 (IOI18_combo)C++17
5 / 100
1 ms208 KiB
#include "combo.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define ln '\n' string B[4] = {"A", "B", "X", "Y"}; string ans, g; int res; string guess_sequence(int n){ res = press("AB"); if (res == 2) ans += "A"; else if (res == 1){ ans = ((press("A"))? "A": "B"); } else { ans = ((press("X"))? "X": "Y"); } for (int i = 0; i < 4; i++){ if (ans.substr(0, 1) == B[i]) {swap(B[i], B[3]); break;} } for (int i = 1; i < n-1; i++){ // cout << 4 * ans.size() + 7 << ln; g = ans + B[0] + B[0] + ans + B[0] + B[1] + ans + B[0] + B[2] + ans + B[1]; res = press(g); if (res == ans.size() + 2) ans += B[0]; else if (res == ans.size() + 1) ans += B[1]; else ans += B[2]; } res = press(ans + B[0]); if (res == ans.size() + 1) ans += B[0]; else { ans += ((press(ans + B[1]) == ans.size() + 1)? B[1]: B[2]); } return ans; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:31:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |         if (res == ans.size() + 2) ans += B[0];
      |             ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:32:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |         else if (res == ans.size() + 1) ans += B[1];
      |                  ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:37:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |     if (res == ans.size() + 1) ans += B[0];
      |         ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:39:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |         ans += ((press(ans + B[1]) == ans.size() + 1)? B[1]: B[2]);
      |                  ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...