QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#371198 | #7804. Intersegment Activation | kevinyang# | RE | 1ms | 3952kb | C++17 | 1.7kb | 2024-03-30 01:49:15 | 2024-03-30 01:49:16 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
int query(pair<int,int>a){
cout << a.first << ' ' << a.second << endl;
int x;
cin >> x;
return x;
}
signed main(){
cin.tie(nullptr)->sync_with_stdio(false);
int n;
cin >> n;
int k;
cin >> k;
if(k==n)return 0;
vector<int>a;
a.push_back(0);
for(int i = 1; i<13; i++){
vector<int>b;
for(int nxt: a){
b.push_back(nxt);
}
b.push_back(i);
for(int nxt: a){
b.push_back(nxt);
}
swap(a,b);
}
for(int i = 1; i<=n; i++){
if(k==n)return 0;
vector<pair<int,int>>vals;
for(int j = i; j<=n; j++){
vals.push_back({i,j});
}
int v = query(vals[a[0]]);
if(v==n)return 0;
if(v==k-1){
int v3 = query(vals[a[0]]);
if(v3==n){
return 0;
}
k = v3;
continue;
}
else{
k = v;
}
int cur = 1;
while(true){
int v = query(vals[a[cur]]);
if(v==n){
return 0;
}
if(cur%2 == 0){
if(v > k){
k = v;
break;
}
if(v < k){
int v3 = query(vals[0]);
if(v3==n){
return 0;
}
k = v3;
break;
}
}
k = v;
cur++;
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3952kb
input:
3 0 0 0 1 1 2 3
output:
1 1 1 2 1 1 2 2 2 3 2 2
result:
ok OK, 6 queries
Test #2:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
1 0 1
output:
1 1
result:
ok OK, 1 queries
Test #3:
score: 0
Accepted
time: 1ms
memory: 3700kb
input:
2 1 2
output:
1 1
result:
ok OK, 1 queries
Test #4:
score: 0
Accepted
time: 0ms
memory: 3672kb
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: -100
Runtime Error
input:
2 0 1 0 0
output:
1 1 1 2 1 1 0 49