제출 #673578

#제출 시각아이디문제언어결과실행 시간메모리
673578tbzard콤보 (IOI18_combo)C++14
0 / 100
1 ms288 KiB
#include <bits/stdc++.h> using namespace std; int press(string s); string guess_sequence(int n){ string ans = ""; string s[4] = {"A", "B", "X", "Y"}; int sum = press(s[0]+s[1]); if(sum == 0){ sum = press(s[2]); if(sum == 1) ans += s[2], swap(s[2], s[3]); else ans += s[3]; } else if(sum == 1){ sum = press(s[0]); if(sum == 1) ans += s[0], swap(s[0], s[3]); else ans += s[1], swap(s[1], s[3]); } else{ ans += s[0]+s[1]; swap(s[0], s[3]); } while(ans.length() != n){ int m = ans.length(); sum = press(ans+s[0] + ans+s[1]+s[0] + ans+s[1]+s[1] + ans+s[1]+s[2]); if(sum == m+1){ if(m+1 == n){ sum = press(ans+s[0]); if(sum == n) ans += s[0]; else ans += s[1]; } else ans += s[0]; } else if(sum == m+2) ans += s[1]; else ans += s[2]; } return ans; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:24:24: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   24 |     while(ans.length() != n){
      |           ~~~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...