QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#371195 | #7804. Intersegment Activation | kevinyang# | RE | 1ms | 3952kb | C++17 | 1.5kb | 2024-03-30 01:46:11 | 2024-03-30 01:46:12 |
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;
}
continue;
}
int cur = 1;
while(true){
int v = query(vals[a[cur]]);
if(v==n){
return 0;
}
if(cur%2 == 0){
if(v > k){
break;
}
if(v < k){
int v3 = query(vals[0]);
if(v3==n){
return 0;
}
break;
}
}
k = v;
cur++;
}
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3720kb
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: 1ms
memory: 3892kb
input:
1 0 1
output:
1 1
result:
ok OK, 1 queries
Test #3:
score: 0
Accepted
time: 1ms
memory: 3720kb
input:
2 1 2
output:
1 1
result:
ok OK, 1 queries
Test #4:
score: 0
Accepted
time: 1ms
memory: 3952kb
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