# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
745581 |
2023-05-20T12:48:39 Z |
lukadupli |
Nizovi (COI14_nizovi) |
C++14 |
|
87 ms |
292 KB |
#include <bits/stdc++.h>
using namespace std;
bool cmp(int a, int b){
cout << "cmp " << a << ' ' << b << endl;
int x;
cin >> x;
return x == -1;
}
void rev(int l, int r){
if(l == r) return;
cout << "reverse " << l << ' ' << r << endl;
}
int A, B;
int main()
{
cin >> A >> B;
rev(1, A);
int pos = A;
if(cmp(A + 1, A)) pos = A + 1;
while(pos > 1){
int l = 1, r = pos;
while(r > l){
int m = (l + r) / 2;
if(cmp(m, pos + 1)) r = m;
else l = m + 1;
}
rev(l, pos);
pos = l;
if(pos == 1) break;
l = pos; r = A + B;
while(r > l){
int m = (l + r + 1) / 2;
if(cmp(m, pos - 1)) l = m;
else r = m - 1;
}
rev(pos, r);
rev(pos - 1, r);
pos--;
}
cout << "end" << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
208 KB |
Output is correct |
2 |
Correct |
7 ms |
208 KB |
Output is correct |
3 |
Correct |
4 ms |
208 KB |
Output is correct |
4 |
Correct |
87 ms |
208 KB |
Output is correct |
5 |
Correct |
66 ms |
208 KB |
Output is correct |
6 |
Correct |
76 ms |
208 KB |
Output is correct |
7 |
Runtime error |
16 ms |
292 KB |
Execution killed with signal 13 |
8 |
Runtime error |
13 ms |
208 KB |
Execution killed with signal 13 |
9 |
Runtime error |
12 ms |
288 KB |
Execution killed with signal 13 |
10 |
Runtime error |
16 ms |
208 KB |
Execution killed with signal 13 |