제출 #1022228

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
10222282024-07-13 11:22:12khome콤보 (IOI18_combo)C++17
5 / 100
804 ms262148 KiB
#include <bits/stdc++.h>
#include "combo.h"
using namespace std;
string guess_sequence(int N) {
vector<char> a;
a={'A', 'B', 'X','Y'};
string res, cur;
char per;
int ab = press("AB"), bx = press("BX"), id;
if (ab == 1) {
if (bx == 1) {per = 'B'; id = 1; res += per;}
if (bx == 2) {per = 'B'; id = 1; res += "BX";}
if (bx == 0) {per = 'A'; id = 0; res += per;}
}
else if (ab == 0) {
if (bx == 1) {per = 'X'; id = 2;}
else {per = 'Y'; id = 3;}
res += per;
}
else if (ab == 2) {per = 'A'; id = 0; res = "AB";}
int n = res.size();
if (n==1){
if (press(res + a[(id+1)%4] + res + a[(id+2)%4]) == 2) { // id == 3 res = "Y"; press("YAYB") == 1;
if (press(res + a[(id+1)%4]) == 2) {res += a[(id+1)%4];}
else res += a[(id+2)%4];
}
else { // press("YAYB") == 0;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:44:28: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   44 |           while (res.size()!=N) res+=i;
      |                  ~~~~~~~~~~^~~
combo.cpp:31:21: warning: 'id' may be used uninitialized in this function [-Wmaybe-uninitialized]
   31 |         res += a[(id+3)%4];
      |                  ~~~^~~
combo.cpp:41:22: warning: 'per' may be used uninitialized in this function [-Wmaybe-uninitialized]
   41 |         if (i != per && i!= res[-1]){
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...