# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
659988 | 2022-11-20T07:23:24 Z | jamezzz | Colors (BOI20_colors) | C++17 | 1 ms | 208 KB |
#include <bits/stdc++.h> using namespace std; #define sf scanf #define pf printf #define pb push_back typedef long long ll; int ask(ll x){ pf("? %lld\n",x); fflush(stdout); int a;sf("%d",&a); return a; } void ans(ll x){ pf("= %lld\n",x); exit(0); } int main(){ ll n;sf("%lld",&n); ll lo=1,hi=n-1,mid,res=-1; vector<ll> v; while(lo<=hi){ mid=(lo+hi)>>1; v.pb(mid); lo=mid+1; } ll cur=1;int m=1; for(int i=v.size()-1;i>=0;--i){ cur+=m*v[i]; m=-m; } ask(cur); lo=1,hi=n-1; while(lo<=hi){ if(lo==hi&&res==-1){ res=lo; break; } mid=(lo+hi)>>1; cur+=m*mid; m=-m; if(ask(cur)==1)res=mid,hi=mid-1; else lo=mid+1; } ans(res); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | OK (4 queries) |
2 | Correct | 0 ms | 208 KB | OK (7 queries) |
3 | Correct | 0 ms | 208 KB | OK (4 queries) |
4 | Correct | 0 ms | 208 KB | OK (5 queries) |
5 | Correct | 1 ms | 208 KB | OK (5 queries) |
6 | Correct | 0 ms | 208 KB | OK (7 queries) |
7 | Correct | 0 ms | 208 KB | OK (7 queries) |
8 | Correct | 0 ms | 208 KB | OK (6 queries) |
9 | Correct | 1 ms | 208 KB | OK (7 queries) |
10 | Correct | 1 ms | 208 KB | OK (4 queries) |
11 | Correct | 1 ms | 208 KB | OK (5 queries) |
12 | Correct | 0 ms | 208 KB | OK (6 queries) |
13 | Correct | 0 ms | 208 KB | OK (7 queries) |
14 | Correct | 1 ms | 208 KB | OK (7 queries) |
15 | Correct | 0 ms | 208 KB | OK (7 queries) |
16 | Correct | 0 ms | 208 KB | OK (7 queries) |
17 | Incorrect | 0 ms | 208 KB | Wrong guess |
18 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | OK (4 queries) |
2 | Correct | 0 ms | 208 KB | OK (7 queries) |
3 | Correct | 0 ms | 208 KB | OK (4 queries) |
4 | Correct | 0 ms | 208 KB | OK (5 queries) |
5 | Correct | 1 ms | 208 KB | OK (5 queries) |
6 | Correct | 0 ms | 208 KB | OK (7 queries) |
7 | Correct | 0 ms | 208 KB | OK (7 queries) |
8 | Correct | 0 ms | 208 KB | OK (6 queries) |
9 | Correct | 1 ms | 208 KB | OK (7 queries) |
10 | Correct | 1 ms | 208 KB | OK (4 queries) |
11 | Correct | 1 ms | 208 KB | OK (5 queries) |
12 | Correct | 0 ms | 208 KB | OK (6 queries) |
13 | Correct | 0 ms | 208 KB | OK (7 queries) |
14 | Correct | 1 ms | 208 KB | OK (7 queries) |
15 | Correct | 0 ms | 208 KB | OK (7 queries) |
16 | Correct | 0 ms | 208 KB | OK (7 queries) |
17 | Incorrect | 0 ms | 208 KB | Wrong guess |
18 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | OK (4 queries) |
2 | Correct | 0 ms | 208 KB | OK (7 queries) |
3 | Correct | 0 ms | 208 KB | OK (4 queries) |
4 | Correct | 0 ms | 208 KB | OK (5 queries) |
5 | Correct | 1 ms | 208 KB | OK (5 queries) |
6 | Correct | 0 ms | 208 KB | OK (7 queries) |
7 | Correct | 0 ms | 208 KB | OK (7 queries) |
8 | Correct | 0 ms | 208 KB | OK (6 queries) |
9 | Correct | 1 ms | 208 KB | OK (7 queries) |
10 | Correct | 1 ms | 208 KB | OK (4 queries) |
11 | Correct | 1 ms | 208 KB | OK (5 queries) |
12 | Correct | 0 ms | 208 KB | OK (6 queries) |
13 | Correct | 0 ms | 208 KB | OK (7 queries) |
14 | Correct | 1 ms | 208 KB | OK (7 queries) |
15 | Correct | 0 ms | 208 KB | OK (7 queries) |
16 | Correct | 0 ms | 208 KB | OK (7 queries) |
17 | Incorrect | 0 ms | 208 KB | Wrong guess |
18 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | OK (4 queries) |
2 | Correct | 0 ms | 208 KB | OK (7 queries) |
3 | Correct | 0 ms | 208 KB | OK (4 queries) |
4 | Correct | 0 ms | 208 KB | OK (5 queries) |
5 | Correct | 1 ms | 208 KB | OK (5 queries) |
6 | Correct | 0 ms | 208 KB | OK (7 queries) |
7 | Correct | 0 ms | 208 KB | OK (7 queries) |
8 | Correct | 0 ms | 208 KB | OK (6 queries) |
9 | Correct | 1 ms | 208 KB | OK (7 queries) |
10 | Correct | 1 ms | 208 KB | OK (4 queries) |
11 | Correct | 1 ms | 208 KB | OK (5 queries) |
12 | Correct | 0 ms | 208 KB | OK (6 queries) |
13 | Correct | 0 ms | 208 KB | OK (7 queries) |
14 | Correct | 1 ms | 208 KB | OK (7 queries) |
15 | Correct | 0 ms | 208 KB | OK (7 queries) |
16 | Correct | 0 ms | 208 KB | OK (7 queries) |
17 | Incorrect | 0 ms | 208 KB | Wrong guess |
18 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | OK (4 queries) |
2 | Correct | 0 ms | 208 KB | OK (7 queries) |
3 | Correct | 0 ms | 208 KB | OK (4 queries) |
4 | Correct | 0 ms | 208 KB | OK (5 queries) |
5 | Correct | 1 ms | 208 KB | OK (5 queries) |
6 | Correct | 0 ms | 208 KB | OK (7 queries) |
7 | Correct | 0 ms | 208 KB | OK (7 queries) |
8 | Correct | 0 ms | 208 KB | OK (6 queries) |
9 | Correct | 1 ms | 208 KB | OK (7 queries) |
10 | Correct | 1 ms | 208 KB | OK (4 queries) |
11 | Correct | 1 ms | 208 KB | OK (5 queries) |
12 | Correct | 0 ms | 208 KB | OK (6 queries) |
13 | Correct | 0 ms | 208 KB | OK (7 queries) |
14 | Correct | 1 ms | 208 KB | OK (7 queries) |
15 | Correct | 0 ms | 208 KB | OK (7 queries) |
16 | Correct | 0 ms | 208 KB | OK (7 queries) |
17 | Incorrect | 0 ms | 208 KB | Wrong guess |
18 | Halted | 0 ms | 0 KB | - |