# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
413656 | Ruxandra985 | Colors (BOI20_colors) | C++14 | 3 ms | 328 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int main()
{
//FILE *fin = fopen ("a.in" , "r");
long long n , c , now , x , sol = 0 , eq , p2 , st , dr , mid , dir , inc;
//fscanf (fin,"%lld%lld",&n,&c);
cin >> n;
now = n;
dir = -1;
inc = n;
st = 1;
dr = n - 1;
while (st <= dr){
mid = (st + dr) / 2;
now = now + dir * mid;
dir = -dir;
if (now >= n){
inc = inc - (now - n);
now = n;
}
st = mid + 1; /// worst case
}
cout << "? " << inc << endl;
cin >> x;
now = inc;
st = 1;
dr = n - 1;
dir = -1;
while (st <= dr){
mid = (st + dr)/2;
now = now + mid * dir;
dir = -dir;
cout << "? " << now << endl;
cin >> x;
if (x)
dr = mid - 1;
else st = mid + 1;
}
cout << "= " << st << endl;
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |