제출 #254603

#제출 시각아이디문제언어결과실행 시간메모리
254603Erkhemkhuu콤보 (IOI18_combo)C++17
97 / 100
42 ms664 KiB
#include <bits/stdc++.h> #include <combo.h> using namespace std; #define ll long long #define pb push_back #define mk make_pair #define F first #define S second string guess_sequence(int n) { string res, seq; int i; if(press("AB")) { if(press("B")) { res = "B"; seq = "AXY"; } else { res = "A"; seq = "BXY"; } } else { if(press("X")) { res = "X"; seq = "ABY"; } else { res = "Y"; seq = "ABX"; } } if(n == 1) return res; for(i = 1; i < n - 1; i++) { string temp = ""; temp = res + seq[0]; temp += res + seq[1] + seq[0]; temp += res + seq[1] + seq[1]; temp += res + seq[1] + seq[2]; int ret = press(temp); if(ret == res.size() + 1) res += seq[0]; else if(ret == res.size() + 2) res += seq[1]; else res += seq[2]; } for(i = 0; i < 3; i++) if(press(res + seq[i]) == n) return res + seq[i]; return res; }

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

combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:40:16: 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(ret == res.size() + 1) res += seq[0];
      |            ~~~~^~~~~~~~~~~~~~~~~
combo.cpp:41:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |         else if(ret == res.size() + 2) res += seq[1];
      |                 ~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...