QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#261295 | #7804. Intersegment Activation | Geospiza | WA | 1ms | 3628kb | C++20 | 2.5kb | 2023-11-22 19:58:34 | 2023-11-22 19:58:35 |
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){
id++;
continue;
}
if(k==n){
return 0;
}
ll now=0;
//cout<<id<<"-\n";
for(int i=1;i<=(1ll<<(n-id+1))+1;i++){
if(k==n){
return 0;
}
if(k>before){
for(int j=id;j<=n;j++){
query(j,j);
ll tmp;
cin>>tmp;
if(tmp==n){
return 0;
}
if(tmp<k){
vis[j]=1;
query(j,j);
cin>>tmp;
}
k=tmp;
}
}
if(k==n){
return 0;
}
before=k;
if(vis[id]==1){
break;
}
if(i==(1ll<<(n-id+1))+1){
break;
}
ll t=mp[v[i]^v[i-1]],f=0;
for(int j=id;j<=t;j++){
if(vis[j]==1){
f=1;
}
}
if(f==1){
continue;
}
query(id,id+t);
cin>>k;
}
//cout<<-1<<"\n";
id++;
}
}
}
/*
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3540kb
input:
3 0 0 0 1 0 1 1 1 1 2 1 2 3
output:
1 1 1 2 1 1 1 1 1 1 2 2 3 3 2 2 2 3 2 2 2 2 3 3
result:
ok OK, 12 queries
Test #2:
score: 0
Accepted
time: 1ms
memory: 3528kb
input:
1 0 1
output:
1 1
result:
ok OK, 1 queries
Test #3:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
2 1 2
output:
1 1
result:
ok OK, 1 queries
Test #4:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
2 0 0 1 0 1 2
output:
1 1 1 2 1 1 1 1 2 2
result:
ok OK, 5 queries
Test #5:
score: 0
Accepted
time: 1ms
memory: 3564kb
input:
2 0 1 0 1 2
output:
1 1 1 1 1 1 2 2
result:
ok OK, 4 queries
Test #6:
score: 0
Accepted
time: 1ms
memory: 3508kb
input:
2 0 0 1 2
output:
1 1 1 2 1 1
result:
ok OK, 3 queries
Test #7:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
3 0 0 0 0 2 3
output:
1 1 1 2 1 1 1 3 1 1
result:
ok OK, 5 queries
Test #8:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
3 0 0 0 0 0 1 0 1 1 1 1 2 3
output:
1 1 1 2 1 1 1 3 1 1 1 1 1 1 2 2 3 3 2 2 2 3 2 2
result:
ok OK, 12 queries
Test #9:
score: 0
Accepted
time: 1ms
memory: 3576kb
input:
3 0 1 0 1 2 3
output:
1 1 1 1 1 1 2 2 3 3
result:
ok OK, 5 queries
Test #10:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
3 0 0 0 0 1 1 1 0 1 1 2 1 2 3
output:
1 1 1 2 1 1 1 3 1 1 2 2 3 3 3 3 1 1 1 2 1 1 1 1 2 2
result:
ok OK, 13 queries
Test #11:
score: 0
Accepted
time: 1ms
memory: 3556kb
input:
4 0 0 0 0 0 0 0 0 0 1 0 1 1 1 1 1 2 1 2 2 2 2 3 2 3 4
output:
1 1 1 2 1 1 1 3 1 1 1 2 1 1 1 4 1 1 1 1 1 1 2 2 3 3 4 4 2 2 2 3 2 2 2 2 3 3 4 4 3 3 3 4 3 3 3 3 4 4
result:
ok OK, 25 queries
Test #12:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
4 0 0 0 0 0 0 0 0 0 0 1 0 1 1 1 1 1 1 1 2 1 2 2 2 2 3 2 3 4
output:
1 1 1 2 1 1 1 3 1 1 1 2 1 1 1 4 1 1 1 2 1 1 1 1 2 2 3 3 4 4 2 2 2 3 2 2 2 4 2 2 2 2 3 3 4 4 3 3 3 4 3 3 3 3 4 4
result:
ok OK, 28 queries
Test #13:
score: 0
Accepted
time: 1ms
memory: 3520kb
input:
4 0 1 0 1 2 3 4
output:
1 1 1 1 1 1 2 2 3 3 4 4
result:
ok OK, 6 queries
Test #14:
score: 0
Accepted
time: 1ms
memory: 3532kb
input:
4 0 0 0 0 0 0 0 0 1 1 1 1 0 1 1 1 1 1 1 2 1 2 3 4
output:
1 1 1 2 1 1 1 3 1 1 1 2 1 1 1 4 1 1 2 2 3 3 4 4 4 4 1 1 1 2 1 1 1 3 1 1 1 2 1 1 1 1 2 2 3 3
result:
ok OK, 23 queries
Test #15:
score: -100
Wrong Answer
time: 1ms
memory: 3520kb
input:
5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 1 1 1 1 2 3 2 3 3 3 2 1 1 1 1 1 1 1 2 3 2 3 3 3 2 1 1 1 2 3 2 3 2
output:
1 1 1 2 1 1 1 3 1 1 1 2 1 1 1 4 1 1 1 2 1 1 1 3 1 1 1 2 1 1 1 5 1 1 1 2 1 1 1 1 1 1 2 2 3 3 4 4 5 5 2 2 2 3 2 2 3 3 3 3 4 4 5 5 2 2 2 4 2 2 2 3 2 2 2 2 2 3 2 2 2 4 2 2 3 3 3 3 4 4 5 5 2 2 2 3 2 2 4 4 4 5 4 4 5 5 5 5 4 4 4 6
result:
wrong answer Integer 6 violates the range [4, 5]