QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#195418#5156. Going in Circleskevinshan#TL 0ms0kbC++202.1kb2023-10-01 04:15:522023-10-01 04:15:53

Judging History

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

  • [2023-10-01 04:15:53]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2023-10-01 04:15:52]
  • 提交

answer

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

#define ll long long
#define all(x) x.begin(), x.end()
#define pb push_back
#define mp make_pair
#define ps push
#define in insert
#define f first
#define s second
#define nl cout<<"\n"
#define ca(v) for(auto i:v) cout<<i<<" ";
#define cbit(x) __builtin_popcount(x)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a*b/gcd(a, b))
int xm[4] = {-1, 1, 0, 0};
int ym[4] = {0, 0, -1, 1};
const int MOD = 1e9 + 7;
const int MAXN = 5e5 + 5;
const ll POW = 9973;

void runsmall(){
    for(int k=0; k<50; k++){
        int x; cin>>x;
        if(x) { cout<<"? flip"<<endl; int y; cin>>y; }
        cout<<"? right"<<endl;
    }
    int ty; cin>>ty;
    cout<<"? flip"<<endl;
    cin>>ty;
    for(int i=1; i<=35; i++){
        cout<<"? left"<<endl;
        int x; cin>>x;
        if(x) {
            cout<<"! "<<i<<endl;
            return;
        }
    }
}

int main()
{
    // ios_base::sync_with_stdio(0); cin.tie(0);
    ll mask = 354768438787341231;
    for(int k=0; k<30; k++){
        int x; cin>>x;
        if(x) {
            cout<<"? flip"<<endl;
            int y; cin>>y;
        }
        cout<<"? right"<<endl;
    }
    int flg = 0;
    for(int k=0; k<30; k++){
        int x; cin>>x;
        if(x){
            cout<<"? left"<<endl;
            runsmall();
            return 0;
        }
        if(mask & (1<<k)){
            cout<<"? flip"<<endl;
            int ty; cin>>ty;
        }
        cout<<"? left"<<endl;
    }
    int tmpkt; cin>> tmpkt;
    cout<<"? left"<<endl;
    cin>> tmpkt;
    cout<<"? left"<<endl;
    
    ll cur = 0;
    int a = 0;
    int firstend = 0;
    int lastend = 0;
    while(1){
        int x; cin>>x;
        if(cur & (1<<29)) cur -= (1<<29);
        cur *= 2;
        cur += x;
        if(a >= 29){
            if(cur == mask){
                if(firstend){
                    cout<<"! "<<a - firstend<<endl;
                    return 0;
                }
                else firstend = a;
            }
        }
        a += 1;
        cout<<"? right"<<endl;
    }
}


详细

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
1
0
1
0
1
0
0
1
0
0
1
0
1
0
1
0
0
1
0
1
0
1
0
1
0
0
0
0
0
0
1
0
1
0
1
0
0
1
0
1
0
0
0
1
0
1
0
1
0
1
0
1
1
0
0
1
1
0
1
1
1
0
0
0
0
0
1
1
1
1
0
1
1
1
0
1
0
1
1
1
1
1
0
0
1
0
0
0
0
0
0
0
1
1
0
1
0
1
...

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...

result: