QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#428596 | #7804. Intersegment Activation | JooDdae | RE | 1ms | 3696kb | C++20 | 809b | 2024-06-01 20:36:02 | 2024-06-01 20:36:02 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n, k;
vector<int> v;
void find(int u) {
if(u == 0) {
v.push_back(0);
return;
}
find(u-1);
v.push_back(u);
find(u-1);
}
int query(int i, int j) {
cout << i << " " << j << endl;
int re; cin >> re;
return re;
}
int main() {
find(9);
cin.tie(0)->sync_with_stdio(0);
cin >> n >> k;
for(int i=1;i<=n;i++) {
auto x = query(i, i);
if(x < k) {
query(i, i);
continue;
}
if(x == k) {
int u = 0;
while(1) {
auto y = query(i, i+v[u++]);
if(y > k) break;
}
}
if(++k == n) return 0;
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3576kb
input:
3 0 0 0 1 1 1 3
output:
1 1 1 1 1 2 2 2 2 2 2 3 3 3
result:
ok OK, 6 queries
Test #2:
score: 0
Accepted
time: 1ms
memory: 3568kb
input:
1 0 1
output:
1 1
result:
ok OK, 1 queries
Test #3:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
2 1 2
output:
1 1
result:
ok OK, 1 queries
Test #4:
score: 0
Accepted
time: 1ms
memory: 3624kb
input:
2 0 0 0 0 1 2
output:
1 1 1 1 1 2 1 1 2 2
result:
ok OK, 5 queries
Test #5:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
2 0 1 2
output:
1 1 2 2
result:
ok OK, 2 queries
Test #6:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
2 0 0 0 2
output:
1 1 1 1 1 2 2 2
result:
ok OK, 3 queries
Test #7:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
3 0 0 0 0 0 3
output:
1 1 1 1 1 2 1 1 1 3 2 2
result:
ok OK, 5 queries
Test #8:
score: 0
Accepted
time: 1ms
memory: 3640kb
input:
3 0 0 0 0 0 1 1 1 1 2 3
output:
1 1 1 1 1 2 1 1 1 3 2 2 2 2 2 3 2 2 3 3
result:
ok OK, 10 queries
Test #9:
score: 0
Accepted
time: 1ms
memory: 3620kb
input:
3 0 1 2 3
output:
1 1 2 2 3 3
result:
ok OK, 3 queries
Test #10:
score: -100
Runtime Error
input:
3 0 0 0 0 0 1 1 1 0 0
output:
1 1 1 1 1 2 1 1 1 3 2 2 2 2 2 3 2 2 2 4