이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "combo.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef double ld;
typedef complex<ld> point;
void debug_out(){cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T){
cerr << H << ' ';
debug_out(T...);
}
#define debug(...) cerr << "(" << #__VA_ARGS__ << "): ", debug_out(__VA_ARGS__)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define MP(x, y) make_pair(x, y)
const int maxn = 2e3 + 10;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int n, ptr[maxn];
vector<string> val[maxn];
std::string guess_sequence(int N) {
n = N;
vector<string> av = {"A", "B", "X", "Y"};
string res;
for (int i = 0; i < 3; i++){
int tmp = press(av[i]);
if (tmp == 1){
res = av[i];
av.erase(av.begin()+i);
}
}
if (res.empty()){
res = av[3];
av.pop_back();
}
for (int i = 1; i < n; i++){
val[i] = av;
shuffle(all(val[i]), rng);
}
while(res.size() < n){
string ask = res;
for (int j = res.size(); j < n; j++){
ask += val[j][ptr[j]];
}
int tmp = press(ask);
res = ask.substr(0, tmp);
ptr[tmp]++;
}
return res;
}
컴파일 시 표준 에러 (stderr) 메시지
combo.cpp: In function 'std::string guess_sequence(int)':
combo.cpp:52:19: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
52 | while(res.size() < n){
| ~~~~~~~~~~~^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |