이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
//macros
typedef long long ll;
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
#define REP(a,b,c) for(int a=int(b); a<int(c); a++)
#define RE(a,c) REP(a,0,c)
#define RE1(a,c) REP(a,1,c+1)
#define REI(a,b,c) REP(a,b,c+1)
#define REV(a,b,c) for(int a=int(c-1); a>=int(b); a--)
#define INF 1e9
#define pb push_back
#define fi first
#define se second
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
string guess_sequence(int N) {
string knows;
if(press("AB")) {
if(press("A")) knows="A";
else knows="B";
} else {
if(press("X")) knows="X";
else knows="Y";
}
string t[3]; int m=0;
if(knows != "A") t[m++]="A";
if(knows != "B") t[m++]="B";
if(knows != "X") t[m++]="X";
if(knows != "Y") t[m++]="Y";
while(knows.size() < N-1) {
int res=press(knows+t[1]+knows+t[2]+t[0]+knows+t[2]+t[1]+knows+t[2]+t[2])-knows.size();
knows += t[res];
}
if(knows.size() == N-1) {
if(press(knows+t[0])!=knows.size()) knows += t[0];
else if(press(knows+t[1])!=knows.size()) knows += t[1];
else knows += t[2];
}
return knows;
}
컴파일 시 표준 에러 (stderr) 메시지
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:38:22: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
38 | while(knows.size() < N-1) {
| ~~~~~~~~~~~~~^~~~~
combo.cpp:42:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
42 | if(knows.size() == N-1) {
| ~~~~~~~~~~~~~^~~~~~
combo.cpp:43:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
43 | if(press(knows+t[0])!=knows.size()) knows += t[0];
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
combo.cpp:44:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
44 | else if(press(knows+t[1])!=knows.size()) knows += t[1];
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |