QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#96372 | #5156. Going in Circles | Sa3tElSefr# | WA | 3ms | 3544kb | C++14 | 2.7kb | 2023-04-13 20:43:39 | 2023-04-13 20:43:41 |
Judging History
answer
///Etfsh5t nseet el rank
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define F first
#define S second
#define f(i, a, b) for (int i = a; i < b; i++)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define sz(x) (int)(x).size()
#define mp(x, y) make_pair(x, y)
#define popCnt(x) (__builtin_popcountll(x))
// #define int ll
using ll = long long;
using ull = unsigned long long;
using uint = uint32_t;
using ii = pair<int, int>;
const int N = 2e5 + 5, A = 12, LG = 18, MOD = (119 << 23) + 1;
const long double PI = acos(-1);
const long double EPS = 1e-9;
const int INF = 1e18;
string str = "101010101001";
int ptr = 0;
bool ask(string x)
{
// if (x == "left")
// {
// ptr = (ptr + str.size() - 1) % str.size();
// return str[ptr] - '0';
// }
// if (x == "right")
// {
// ptr = (ptr + 1) % str.size();
// return str[ptr] - '0';
// }
// if (x == "flip")
// {
// str[ptr] ^= 1;
// return str[ptr] - '0';
// }
cout << "? " << x << endl;
bool ret;
cin >> ret;
return ret;
}
const int MX = 100;
void doWork()
{
cout << str.size() << endl;
srand(time(0));
int cur;
cin >> cur;
vector<int> vals;
vals.push_back(cur);
for (int i = 0; i < MX; i++)
{
vals.push_back(cur);
int val = rand() & 1;
if (ask("right") != val)
ask("flip");
cur = val;
}
bool small = false;
for (int i = 0; i < MX; i++)
{
int val = ask("left");
if (val != vals[MX - 1 - i])
{
small = true;
}
}
if (small)
{
for (int i = 0; i < MX; i++)
{
if (cur)
ask("flip");
cur = ask("right");
}
ask("flip");
for (int i = 1;; i++)
{
if (ask("right"))
{
cout << "! " << i << endl;
return;
}
}
}
deque<int> vec;
for (int i = 0; i < MX; i++)
{
vec.push_back(cur);
cur = ask("right");
}
deque<int> dq;
for (int i = 1;; i++)
{
dq.push_back(cur);
if (dq.size() > MX)
dq.pop_front();
if (dq == vec)
{
cout << "! " << i + 1 << endl;
return;
}
}
}
int32_t main()
{
#ifdef ONLINE_JUDGE
ios_base::sync_with_stdio(0);
cin.tie(0);
#endif // ONLINE_JUDGE
int t = 1;
// cin >> t;
while (t--)
{
doWork();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 3ms
memory: 3544kb
input:
0
output:
12 ? right
result:
wrong answer Wrong answer: invalid response type. Queries used: 0