QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#261277 | #7804. Intersegment Activation | Geospiza | WA | 1ms | 3612kb | C++20 | 2.4kb | 2023-11-22 19:45:28 | 2023-11-22 19:45:29 |
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){
return 0;
}
ll now=0;
//cout<<id<<"-\n";
for(int i=1;i<=(1ll<<(n-id))+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;
}
}
before=k;
if(vis[id]==1){
break;
}
if(i==(1ll<<(n-id))+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: 0ms
memory: 3612kb
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: 3544kb
input:
1 0 1
output:
1 1
result:
ok OK, 1 queries
Test #3:
score: 0
Accepted
time: 0ms
memory: 3504kb
input:
2 1 2
output:
1 1
result:
ok OK, 1 queries
Test #4:
score: 0
Accepted
time: 0ms
memory: 3580kb
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: 3556kb
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: 3528kb
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: 3560kb
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: -100
Wrong Answer
time: 1ms
memory: 3572kb
input:
3 0 0 0 0 0 0 1 0 1 2 1
output:
1 1 1 2 1 1 1 3 2 2 2 3 2 2 2 2 3 3 3 3
result:
wrong answer format Unexpected end of file - int32 expected