QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#371190 | #7804. Intersegment Activation | kevinyang# | RE | 1ms | 3896kb | C++17 | 1.5kb | 2024-03-30 01:38:00 | 2024-03-30 01:38:02 |
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){
query(vals[a[0]]);
continue;
}
int cur = 1;
while(true){
int v = query(vals[a[cur]]);
if(v==n){
return 0;
}
if(v > k){
int v2 = query(vals[0]);
if(v2 == n){
return 0;
}
int v3 = query(vals[0]);
if(v3 == n){
return 0;
}
if(v2 < v){
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: 3676kb
input:
3 0 0 0 1 0 1 1 2 3
output:
1 1 1 2 1 1 1 1 1 1 2 2 2 3 2 2
result:
ok OK, 8 queries
Test #2:
score: 0
Accepted
time: 1ms
memory: 3620kb
input:
1 0 1
output:
1 1
result:
ok OK, 1 queries
Test #3:
score: 0
Accepted
time: 1ms
memory: 3896kb
input:
2 1 2
output:
1 1
result:
ok OK, 1 queries
Test #4:
score: 0
Accepted
time: 1ms
memory: 3648kb
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