QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#199351 | #5156. Going in Circles | kevinshan | TL | 0ms | 0kb | C++20 | 2.2kb | 2023-10-04 09:55:05 | 2023-10-04 09:55:05 |
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 = (ll)354768438787341231;
// cout<<mask;
for(int k=0; k<30; k++){
int x; cin>>x;
if(x) {
cout<<"? flip"<<endl;
int y; cin>>y;
}
cout<<"? right"<<endl;
}
int txx; cin>>txx;
cout<<"? left"<<endl;
for(int k=0; k<30; k++){
int x; cin>>x;
if(x){
cout<<"? left"<<endl;
runsmall();
return 0;
}
if(mask & (ll)(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 & (ll)((ll)1<<29)) cur -= (ll)((ll)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 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 1 0 1 0 1 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 0 1 0 0 1 0 0 0 0 0 0 0 1 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...