QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#133869 | #5156. Going in Circles | BUET_TEAM_ONE# | TL | 0ms | 0kb | C++20 | 2.2kb | 2023-08-02 16:03:06 | 2023-08-02 16:03:08 |
Judging History
answer
#include <bits/stdc++.h>
typedef long long int ll;
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define fill(x, y) memset(x, y, sizeof(x))
#define all(x) (x).begin(), (x).end()
#define debug(x) { cerr << #x << " = " << x << endl; }
#define IO { ios_base::sync_with_stdio(false); cin.tie(0); }
#define read(x) freopen(x, "r", stdin)
#define write(x) freopen(x, "w", stdout)
using namespace std;
mt19937 mt(time(nullptr));
void left() {
cout << "? left" << endl;
}
void right() {
cout << "? right" << endl;
}
void flip() {
cout << "? flip" << endl;
}
const int N = 64;
bitset<N> org;
bitset<N> cur_seq;
void solve() {
int cur;
bool flag = true;
for (int i=0; i<N; i++) {
cin >> cur;
if (cur != 0) {
flip();
cin >> cur;
}
right();
}
for (int i=0; i<N; i++) {
cin >> cur;
if (cur != 1) {
flip();
cin >> cur;
}
right();
}
cin >> cur;
bool allOne = true;
for (int i=0; i<2*N; i++) {
left();
cin >> cur;
if (cur != 1) allOne = false;
}
if (allOne) {
// length <= N
flip();
cin >> cur;
int i = 1;
while(1) {
right();
cin >> cur;
if (cur == 0) break;
i++;
}
cout <<"! "<< i<< endl;
} else {
// length > N
for(int i=0;i<N;i++){
org[i]=mt()%2;
}
for(int i=0; i<N; i++) {
right();
cin >> cur;
if (cur != org[i]) {
flip();
cin >> cur;
}
}
cur_seq = org;
int idx = 1;
while(1) {
right();
cin >> cur;
cur_seq <<= 1;
cur_seq |= cur;
if ( (cur_seq ^ org).count() == 0 ) break;
idx++;
}
cout <<"! "<< idx << endl;
}
}
int main() {
cout << fixed << setprecision(10);
solve();
}
详细
Test #1:
score: 0
Time Limit Exceeded
input:
0 1 0 0 0 1 0 0 1 0 0 1 0 1 0 1 0 1 0 1 0 0 0 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 1 0 0 1 0 0 1 0 1 0 1 0 1 0 1 0 0 0 1 1 0 1 1 1 1 1 1 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 1 1 0 1 1 0 ...
output:
? right ? flip ? right ? right ? right ? flip ? right ? right ? flip ? right ? right ? flip ? right ? flip ? right ? flip ? right ? flip ? right ? flip ? right ? right ? right ? flip ? right ? right ? flip ? right ? flip ? right ? flip ? right ? flip ? right ? flip ? right ? flip ? right ? flip ? ri...