QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#106285 | #5156. Going in Circles | joesmitty | WA | 38ms | 3536kb | C++14 | 3.6kb | 2023-05-17 09:00:15 | 2023-05-17 09:00:16 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned int uint;
typedef vector<int> vi;
typedef vector< vector <int> > vvi;
typedef pair<int, int> pii;
typedef pair < pair < int, int >, int > piii;
typedef pair < pair <int, int > , pair <int, int> > piiii;
typedef pair<ll, ll> pll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
#define FOR(i,a,b) for(int i = a; i < b; i ++)
#define RFOR(i,a,b) for(int i = a-1; i >= b; i --)
#define all(a) a.begin(), a.end()
//#define endl '\n';
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
template <typename T>
void pr(vector<T> &v) {
FOR(i, 0, sz(v)) cout << v[i] << " ";
cout << endl;
}
template <typename T>
void pr(vector<vector<T> > &v) {
FOR(i, 0, sz(v)) { pr(v[i]); }
}
template <typename T>
void re(T &x) {
cin >> x;
}
template <typename T>
void re(vector<T> &a) {
FOR(i, 0, sz(a)) re(a[i]);
}
template <class Arg, class... Args>
void re(Arg &first, Args &... rest) {
re(first);
re(rest...);
}
template <typename T>
void pr(T x) {
cout << x << endl;
}
template <class Arg, class... Args>
void pr(const Arg &first, const Args &... rest) {
cout << first << " ";
pr(rest...);
cout << endl;
}
void ps() { cout << endl; }
template<class T, class... Ts>
void ps(const T& t, const Ts&... ts) {
cout << t; if (sizeof...(ts)) cout << " "; ps(ts...);
}
const ll MOD = 998244353;
#define inf 1e18;
#define INF INT_MAX;
long double PI = 4*atan(1);
long double eps = 1e-12;
int init;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
bool test(int n) {
int check = 0;
int t = 0;
FOR(i,0,n) {
cout << "? right" << endl;
cin >> t;
}
cout << "? flip" << endl;
cin >> check;
FOR(i,0,n) {
cout << "? left" << endl;
cin >> t;
}
if(t != init) {
init = t;
return true;
}
init = t;
return false;
}
int main() {
//auto start = chrono::high_resolution_clock::now();
ios_base::sync_with_stdio(0);cin.tie(0);
// freopen("promote.in", "r", stdin);
// freopen("promote.out", "w", stdout);
#ifdef DEBUG
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
cin >> init;
FOR(i,3,23) {
if(test(i)) {
cout << "! " << i << endl;
return 0;
}
}
vector<int> pat;
int t = init;
FOR(i,0,23) {
int tog = uniform_int_distribution<ll>(0, 1)(rng);
// cout << "T: " << tog << endl;
if(tog) {
cout << "? flip" << endl;
cin >> t;
pat.pb(t);
} else {
pat.pb(t);
}
cout << "? right" << endl;
cin >> t;
}
vector<int> x;
x.pb(t);
FOR(i,0,5010) {
int N = x.size();
if(N >= 23) {
bool good = true;
FOR(j,0, 20) {
if(x[N - 20 + j] != pat[j]) good = false;
}
if(good) {
cout << "! " << N << endl;
return 0;
}
}
cout << "? right" << endl;
cin >> t;
x.pb(t);
}
// auto stop = chrono::high_resolution_clock::now();
// auto duration = chrono::duration_cast<chrono::microseconds>(stop - start);
// cout << duration.count() << endl;
//cin.close();
//cout.close();
}
详细
Test #1:
score: 0
Wrong Answer
time: 38ms
memory: 3536kb
input:
0 1 0 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 1 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 1 0 0 ...
output:
? right ? right ? right ? flip ? left ? left ? left ? right ? right ? right ? right ? flip ? left ? left ? left ? left ? right ? right ? right ? right ? right ? flip ? left ? left ? left ? left ? left ? right ? right ? right ? right ? right ? right ? flip ? left ? left ? left ? left ? left ? left ? ...
result:
wrong answer Wrong answer: incorrect guess 4997 (ans: 5000). Queries used: 5552