QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#261299 | #7804. Intersegment Activation | Geospiza | WA | 1ms | 3928kb | C++20 | 2.5kb | 2023-11-22 20:02:00 | 2023-11-22 20:02:02 |
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));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))){
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++;
}
}
}
/*
*/
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3684kb
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: 3736kb
input:
1 0 1
output:
1 1
result:
ok OK, 1 queries
Test #3:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
2 1 2
output:
1 1
result:
ok OK, 1 queries
Test #4:
score: 0
Accepted
time: 0ms
memory: 3724kb
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: 3684kb
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: 3928kb
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: 3748kb
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: 1ms
memory: 3900kb
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: 3740kb
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: 1ms
memory: 3620kb
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: 3620kb
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: 3616kb
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: 3704kb
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: 3692kb
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: 3864kb
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
result:
wrong answer format Unexpected end of file - int32 expected