이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
//#include "insects.h"
#define f first
#define s second
#define pb push_back
#define pii pair<int,int>
#define ll long long
using namespace std;
int press(std::string p);
string guess_sequence(int N){
string ans;
string s[4];
if(press("A")==1)ans="A",s[0]="A",s[1]="B",s[2]="X",s[3]="Y";
else if(press("B")==1)ans="B",s[0]="B",s[1]="A",s[2]="X",s[3]="Y";
else if(press("X")==1)ans="X",s[0]="X",s[1]="B",s[2]="A",s[3]="Y";
else ans="Y",s[0]="Y",s[1]="B",s[2]="X",s[3]="A";
for(int i=2;i<=N-1;i++){
string now1 = ans+s[1];
string now2 = ans+s[2]+s[1];
string now3 = ans+s[2]+s[2];
string now4 = ans+s[2]+s[3];
string tt = now1+now2+now3+now4;
int x = press(tt);
if(x==i-1)ans = ans+s[3];
else if(x==i)ans = ans+s[1];
else ans = ans+s[2];
}if(press(ans+s[1])==N)return ans+s[1];
if(press(ans+s[2])==N)return ans+s[2];
if(press(ans+s[3])==N)return ans+s[3];
}
컴파일 시 표준 에러 (stderr) 메시지
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:11:12: warning: control reaches end of non-void function [-Wreturn-type]
11 | string ans;
| ^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |