QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#66131#5156. Going in Circlesfeeder1#TL 0ms0kbC++141.1kb2022-12-07 00:22:442022-12-07 00:22:46

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-12-07 00:22:46]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2022-12-07 00:22:44]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
 int t, cur;
 cin >> t;
 for (int i=3; i<=20; i+=2) {
  cur = t;
  for (int j=1; j<=i; j++) {
   cout << "? right" << endl;
   cin >> t;
  }
  if (t != cur) continue;
  cout << "? flip" << endl;
  cin >> t;
  for (int j=1; j<=i; j++) {
   cout << "? left" << endl;
   cin >> t;
  }
  if (t == cur) continue;
  cout << "! " << i << endl;
  return 0;
 }
 srand(123);
 int cmp[20];
 for (int i=0; i<20; i++) cmp[i] = rand() % 2;
 if (cmp[0] != t) {
  cout << "? flip" << endl;
  cin >> t;
 }
 for (int i=1; i<20; i++) {
  cout << "? right" << endl;
  cin >> t;
  if (t == cmp[i]) continue;
  cout << "? flip" << endl;
  cin >> t;
 }
 
 deque<int> dq;
 int n = 0;
 while (true) {
  cout << "? right" << endl;
  cin >> t;
  dq.push_back(t);
  n++;
  if (dq.size() > 20) dq.pop_back();
  if (dq.size() < 20) continue;
  bool same = 1;
  for (int i=0; i<20; i++) {
   if (cmp[i] != dq[i]) {
    same = 0;
    break;
   }
  }
  if (!same) continue;
  cout << "! " << n << endl;
  return 0;
 }
}

詳細信息

Test #1:

score: 0
Time Limit Exceeded

input:

0
1
0
0
1
0
1
0
1
0
1
1
0
1
1
1
0
1
0
1
0
1
1
1
1
0
1
1
1
1
1
0
1
0
1
0
1
1
1
1
1
1
1
1
1
1
0
0
1
0
1
1
1
1
0
1
1
1
0
1
0
0
1
1
1
1
1
1
1
0
0
1
0
1
1
1
0
1
1
0
1
0
1
1
1
0
1
0
0
1
1
1
1
1
1
1
0
0
1
0
1
1
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
...

output:

? right
? right
? right
? flip
? left
? left
? left
? right
? right
? right
? right
? right
? flip
? left
? left
? left
? left
? left
? right
? right
? right
? right
? right
? right
? right
? flip
? left
? left
? left
? left
? left
? left
? left
? right
? right
? right
? right
? right
? right
? righ...

result: