이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <cstdlib>
using namespace std;
int main(){
int n, m, k, maxq;
cin >> n >> m >> k >> maxq;
// m, k should be 1
int lo = 1, hi = n+1;
// we want local maximum somewhere in [lo, hi)
while(lo+1 < hi){
int mi = (lo + hi) / 2;
int r1, r2;
cout << "? " << mi-1 << " 1 1" << endl;
cin >> r1;
if (r1 == -1) exit(0);
cout << "? " << mi << " 1 1" << endl;
cin >> r2;
if (r2 == -1) exit(0);
if(r1 >= r2) hi = mi;
else lo = mi;
}
cout << "! " << lo << " 1 1" << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |