QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#260945 | #7804. Intersegment Activation | Geospiza# | WA | 1ms | 3564kb | C++20 | 2.0kb | 2023-11-22 16:48:48 | 2023-11-22 16:48:50 |
Judging History
answer
//#pragma GCC optimize(3,"Ofast","inline")
//#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
const int N = 1ll<<14;
ll tot=0;
ll lowbit(ll x){
return x&(-x);
}
void query(int i,int j){
tot++;
assert(tot<=2500);
cout<<i<<" "<<j<<endl;
}
int main(){
//cout<<lowbit(11)<<"\n";exit(0);
ios::sync_with_stdio(0); cin.tie(0);
int T=1;
//cin>>T;
map<int,int>mp;
for(int i=0;i<14;i++){
mp[1ll<<i]=i;
}
vector<ll>v(1,0);
ll now=0,cnt=1,sta=0;
while(cnt<N){
if(sta==0){
now^=1;
v.push_back(now);
}
else{
now^=2*(lowbit(now));
v.push_back(now);
}
cnt++;sta^=1;
}
//for(int i=0;i<32;i++)cout<<v[i]<<"\n";return 0;
vector<int>vis(20);
while(T--)
{
ll n,k;
cin>>n>>k;
ll id=1,before=n;
while(id<=n){
if(vis[id]==1){
continue;
}
if(k==n){
break;
}
ll now=0;
//cout<<id<<"-\n";
for(int i=1;i<=(1ll<<(n-id));i++){
if(k==n){
break;
}
if(k>before){
for(int j=id;j<=n;j++){
query(j,j);
ll tmp;
cin>>tmp;
if(tmp<k){
vis[j]=1;
query(j,j);
cin>>tmp;
}
}
if(vis[id]==1){
break;
}
}
before=k;
ll t=mp[v[i]^v[i-1]];
query(id,id+t);
cin>>k;
}
before=k;
//cout<<-1<<"\n";
id++;
}
}
}
/*
*/
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3556kb
input:
3 0 0 0 1 0 1 1 1 1 2 3
output:
1 1 1 2 1 1 1 1 1 1 2 2 3 3 2 2 2 3 3 3
result:
ok OK, 10 queries
Test #2:
score: 0
Accepted
time: 0ms
memory: 3496kb
input:
1 0 1
output:
1 1
result:
ok OK, 1 queries
Test #3:
score: 0
Accepted
time: 1ms
memory: 3564kb
input:
2 1 2
output:
1 1
result:
ok OK, 1 queries
Test #4:
score: 0
Accepted
time: 1ms
memory: 3564kb
input:
2 0 0 1 2
output:
1 1 1 2 2 2
result:
ok OK, 3 queries
Test #5:
score: 0
Accepted
time: 1ms
memory: 3500kb
input:
2 0 1 0 1 2
output:
1 1 1 1 1 1 2 2 2 2
result:
ok OK, 4 queries
Test #6:
score: -100
Wrong Answer
time: 1ms
memory: 3564kb
input:
2 0 0 1 0
output:
1 1 1 2 2 2
result:
wrong answer format Unexpected end of file - int32 expected