답안 #914321

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
914321 2024-01-21T15:51:45 Z 3as8 Colors (BOI20_colors) C++14
0 / 100
1 ms 344 KB
#include <bits/stdc++.h>

#define ll long long
#define fastIO cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false);

#define mid ((l + r) / 2)
#define lChild ((index * 2) + 1)
#define rChild ((index * 2) + 2)

using namespace std;

void solve(ll _) {

    ll n; cin>>n;

    if(n == 1) {
        cout<<"= 1"<<endl;
        return;
    }
    cout<<"? "<<1<<endl;
    bool curr; cin>>curr;
    ll ans = 0;


    ll last = 1, now = n;
    bool left = true;
    while(true) {

        cout<<"? "<<now<<endl;
        cin>>curr;

        if(curr == 1) ans = abs(now - last);

        ll temp = last;
        last = now;
        now = temp + (left ? 1 : -1);

        if(now == last) break;

        left = !left;

    }

    cout<<"= "<<ans<<endl;
}

int main() {
    fastIO

    //freopen("file.in", "r", stdin);
    //freopen("file.out", "w", stdout);

    ll t = 0; solve(t);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB OK (7 queries)
2 Correct 1 ms 344 KB OK (49 queries)
3 Correct 0 ms 344 KB OK (10 queries)
4 Correct 0 ms 344 KB OK (26 queries)
5 Correct 0 ms 344 KB OK (23 queries)
6 Correct 1 ms 344 KB OK (56 queries)
7 Correct 1 ms 344 KB OK (52 queries)
8 Correct 1 ms 344 KB OK (43 queries)
9 Correct 1 ms 340 KB OK (46 queries)
10 Correct 1 ms 344 KB OK (11 queries)
11 Correct 1 ms 344 KB OK (14 queries)
12 Correct 0 ms 344 KB OK (23 queries)
13 Correct 0 ms 344 KB OK (47 queries)
14 Correct 0 ms 344 KB OK (44 queries)
15 Correct 1 ms 344 KB OK (54 queries)
16 Correct 1 ms 344 KB OK (53 queries)
17 Incorrect 0 ms 344 KB Integer parameter [name=k] equals to 0, violates the range [1, 35]
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB OK (7 queries)
2 Correct 1 ms 344 KB OK (49 queries)
3 Correct 0 ms 344 KB OK (10 queries)
4 Correct 0 ms 344 KB OK (26 queries)
5 Correct 0 ms 344 KB OK (23 queries)
6 Correct 1 ms 344 KB OK (56 queries)
7 Correct 1 ms 344 KB OK (52 queries)
8 Correct 1 ms 344 KB OK (43 queries)
9 Correct 1 ms 340 KB OK (46 queries)
10 Correct 1 ms 344 KB OK (11 queries)
11 Correct 1 ms 344 KB OK (14 queries)
12 Correct 0 ms 344 KB OK (23 queries)
13 Correct 0 ms 344 KB OK (47 queries)
14 Correct 0 ms 344 KB OK (44 queries)
15 Correct 1 ms 344 KB OK (54 queries)
16 Correct 1 ms 344 KB OK (53 queries)
17 Incorrect 0 ms 344 KB Integer parameter [name=k] equals to 0, violates the range [1, 35]
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB OK (7 queries)
2 Correct 1 ms 344 KB OK (49 queries)
3 Correct 0 ms 344 KB OK (10 queries)
4 Correct 0 ms 344 KB OK (26 queries)
5 Correct 0 ms 344 KB OK (23 queries)
6 Correct 1 ms 344 KB OK (56 queries)
7 Correct 1 ms 344 KB OK (52 queries)
8 Correct 1 ms 344 KB OK (43 queries)
9 Correct 1 ms 340 KB OK (46 queries)
10 Correct 1 ms 344 KB OK (11 queries)
11 Correct 1 ms 344 KB OK (14 queries)
12 Correct 0 ms 344 KB OK (23 queries)
13 Correct 0 ms 344 KB OK (47 queries)
14 Correct 0 ms 344 KB OK (44 queries)
15 Correct 1 ms 344 KB OK (54 queries)
16 Correct 1 ms 344 KB OK (53 queries)
17 Incorrect 0 ms 344 KB Integer parameter [name=k] equals to 0, violates the range [1, 35]
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB OK (7 queries)
2 Correct 1 ms 344 KB OK (49 queries)
3 Correct 0 ms 344 KB OK (10 queries)
4 Correct 0 ms 344 KB OK (26 queries)
5 Correct 0 ms 344 KB OK (23 queries)
6 Correct 1 ms 344 KB OK (56 queries)
7 Correct 1 ms 344 KB OK (52 queries)
8 Correct 1 ms 344 KB OK (43 queries)
9 Correct 1 ms 340 KB OK (46 queries)
10 Correct 1 ms 344 KB OK (11 queries)
11 Correct 1 ms 344 KB OK (14 queries)
12 Correct 0 ms 344 KB OK (23 queries)
13 Correct 0 ms 344 KB OK (47 queries)
14 Correct 0 ms 344 KB OK (44 queries)
15 Correct 1 ms 344 KB OK (54 queries)
16 Correct 1 ms 344 KB OK (53 queries)
17 Incorrect 0 ms 344 KB Integer parameter [name=k] equals to 0, violates the range [1, 35]
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB OK (7 queries)
2 Correct 1 ms 344 KB OK (49 queries)
3 Correct 0 ms 344 KB OK (10 queries)
4 Correct 0 ms 344 KB OK (26 queries)
5 Correct 0 ms 344 KB OK (23 queries)
6 Correct 1 ms 344 KB OK (56 queries)
7 Correct 1 ms 344 KB OK (52 queries)
8 Correct 1 ms 344 KB OK (43 queries)
9 Correct 1 ms 340 KB OK (46 queries)
10 Correct 1 ms 344 KB OK (11 queries)
11 Correct 1 ms 344 KB OK (14 queries)
12 Correct 0 ms 344 KB OK (23 queries)
13 Correct 0 ms 344 KB OK (47 queries)
14 Correct 0 ms 344 KB OK (44 queries)
15 Correct 1 ms 344 KB OK (54 queries)
16 Correct 1 ms 344 KB OK (53 queries)
17 Incorrect 0 ms 344 KB Integer parameter [name=k] equals to 0, violates the range [1, 35]
18 Halted 0 ms 0 KB -