Submission #914279

# Submission time Handle Problem Language Result Execution time Memory
914279 2024-01-21T13:52:33 Z Abito Colors (BOI20_colors) C++14
0 / 100
1 ms 456 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define F first
#define S second
#define pb push_back
#define ppb pop_back
#define ep insert
//#define endl '\n'
#define elif else if
#define pow pwr
#define sqrt sqrtt
#define int long long
#define ll long long
#define y1 YONE
#define free freeee
#define lcm llcm
/*
⠄⠄⠄⠄⢠⣿⣿⣿⣿⣿⢻⣿⣿⣿⣿⣿⣿⣿⣿⣯⢻⣿⣿⣿⣿⣆⠄⠄⠄
⠄⠄⣼⢀⣿⣿⣿⣿⣏⡏⠄⠹⣿⣿⣿⣿⣿⣿⣿⣿⣧⢻⣿⣿⣿⣿⡆⠄⠄
⠄⠄⡟⣼⣿⣿⣿⣿⣿⠄⠄⠄⠈⠻⣿⣿⣿⣿⣿⣿⣿⣇⢻⣿⣿⣿⣿⠄⠄
⠄⢰⠃⣿⣿⠿⣿⣿⣿⠄⠄⠄⠄⠄⠄⠙⠿⣿⣿⣿⣿⣿⠄⢿⣿⣿⣿⡄⠄
⠄⢸⢠⣿⣿⣧⡙⣿⣿⡆⠄⠄⠄⠄⠄⠄⠄⠈⠛⢿⣿⣿⡇⠸⣿⡿⣸⡇⠄
⠄⠈⡆⣿⣿⣿⣿⣦⡙⠳⠄⠄⠄⠄⠄⠄⢀⣠⣤⣀⣈⠙⠃⠄⠿⢇⣿⡇⠄
⠄⠄⡇⢿⣿⣿⣿⣿⡇⠄⠄⠄⠄⠄⣠⣶⣿⣿⣿⣿⣿⣿⣷⣆⡀⣼⣿⡇⠄
⠄⠄⢹⡘⣿⣿⣿⢿⣷⡀⠄⢀⣴⣾⣟⠉⠉⠉⠉⣽⣿⣿⣿⣿⠇⢹⣿⠃⠄
⠄⠄⠄⢷⡘⢿⣿⣎⢻⣷⠰⣿⣿⣿⣿⣦⣀⣀⣴⣿⣿⣿⠟⢫⡾⢸⡟⠄.
⠄⠄⠄⠄⠻⣦⡙⠿⣧⠙⢷⠙⠻⠿⢿⡿⠿⠿⠛⠋⠉⠄⠂⠘⠁⠞⠄⠄⠄
⠄⠄⠄⠄⠄⠈⠙⠑⣠⣤⣴⡖⠄⠿⣋⣉⣉⡁⠄⢾⣦⠄⠄⠄⠄⠄⠄⠄⠄
*/
typedef unsigned long long ull;
using namespace std;
int a[64],n,c=1;
int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    cin>>n;;
    set<int> s;bool h;
    cout<<"? 1"<<endl;cin>>h;
    for (int i=2;i<=n;i++) s.ep(i);
    int last=1,x;
    if (n&1) x=n-1;
    else x=n-2;
    int y=0;
    for (int i=x;i;i-=2){
        if (s.count(last+i)){
            cout<<"? "<<last+i<<endl;
            cin>>h;
            last+=i;
        }
        else{
            cout<<"? "<<last-i<<endl;
            cin>>h;
            last-=i;
        }
        s.erase(last);
        if (!h) {y=i;break;}
    }
    if (y+1==n){
        cout<<"= "<<n<<endl;
        return 0;
    }
    if (last+y+1<=n) cout<<"? "<<last+y+1<<endl,cin>>h;
    elif (last-y-1>0) cout<<"? "<<last-y-1<<endl,cin>>h;
    else{
        for (int i=1;i<=n;i++){
            if (!s.count(i)) continue;
            if (s.count(i+y+1)){
                cout<<"? "<<i<<endl;cin>>h;
                cout<<"? "<<i+y+1<<endl;cin>>h;
                break;
            }
            if (s.count(i-y-1)){
                cout<<"? "<<i<<endl;cin>>h;
                cout<<"? "<<i-y-1<<endl;cin>>h;
                break;
            }
        }
    }
    if (h) cout<<"= "<<y+1<<endl;
    else cout<<"= "<<y+2<<endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB OK (5 queries)
2 Correct 1 ms 456 KB OK (5 queries)
3 Correct 1 ms 344 KB OK (6 queries)
4 Correct 1 ms 344 KB OK (14 queries)
5 Correct 0 ms 344 KB OK (9 queries)
6 Correct 1 ms 456 KB OK (15 queries)
7 Correct 1 ms 448 KB OK (10 queries)
8 Correct 0 ms 344 KB OK (6 queries)
9 Correct 0 ms 452 KB OK (6 queries)
10 Correct 0 ms 344 KB OK (7 queries)
11 Correct 1 ms 344 KB OK (4 queries)
12 Correct 1 ms 344 KB OK (5 queries)
13 Correct 1 ms 448 KB OK (8 queries)
14 Correct 0 ms 448 KB OK (10 queries)
15 Correct 0 ms 456 KB OK (7 queries)
16 Correct 1 ms 448 KB OK (19 queries)
17 Correct 0 ms 344 KB OK (2 queries)
18 Correct 0 ms 344 KB OK (10 queries)
19 Incorrect 0 ms 344 KB Wrong guess
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB OK (5 queries)
2 Correct 1 ms 456 KB OK (5 queries)
3 Correct 1 ms 344 KB OK (6 queries)
4 Correct 1 ms 344 KB OK (14 queries)
5 Correct 0 ms 344 KB OK (9 queries)
6 Correct 1 ms 456 KB OK (15 queries)
7 Correct 1 ms 448 KB OK (10 queries)
8 Correct 0 ms 344 KB OK (6 queries)
9 Correct 0 ms 452 KB OK (6 queries)
10 Correct 0 ms 344 KB OK (7 queries)
11 Correct 1 ms 344 KB OK (4 queries)
12 Correct 1 ms 344 KB OK (5 queries)
13 Correct 1 ms 448 KB OK (8 queries)
14 Correct 0 ms 448 KB OK (10 queries)
15 Correct 0 ms 456 KB OK (7 queries)
16 Correct 1 ms 448 KB OK (19 queries)
17 Correct 0 ms 344 KB OK (2 queries)
18 Correct 0 ms 344 KB OK (10 queries)
19 Incorrect 0 ms 344 KB Wrong guess
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB OK (5 queries)
2 Correct 1 ms 456 KB OK (5 queries)
3 Correct 1 ms 344 KB OK (6 queries)
4 Correct 1 ms 344 KB OK (14 queries)
5 Correct 0 ms 344 KB OK (9 queries)
6 Correct 1 ms 456 KB OK (15 queries)
7 Correct 1 ms 448 KB OK (10 queries)
8 Correct 0 ms 344 KB OK (6 queries)
9 Correct 0 ms 452 KB OK (6 queries)
10 Correct 0 ms 344 KB OK (7 queries)
11 Correct 1 ms 344 KB OK (4 queries)
12 Correct 1 ms 344 KB OK (5 queries)
13 Correct 1 ms 448 KB OK (8 queries)
14 Correct 0 ms 448 KB OK (10 queries)
15 Correct 0 ms 456 KB OK (7 queries)
16 Correct 1 ms 448 KB OK (19 queries)
17 Correct 0 ms 344 KB OK (2 queries)
18 Correct 0 ms 344 KB OK (10 queries)
19 Incorrect 0 ms 344 KB Wrong guess
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB OK (5 queries)
2 Correct 1 ms 456 KB OK (5 queries)
3 Correct 1 ms 344 KB OK (6 queries)
4 Correct 1 ms 344 KB OK (14 queries)
5 Correct 0 ms 344 KB OK (9 queries)
6 Correct 1 ms 456 KB OK (15 queries)
7 Correct 1 ms 448 KB OK (10 queries)
8 Correct 0 ms 344 KB OK (6 queries)
9 Correct 0 ms 452 KB OK (6 queries)
10 Correct 0 ms 344 KB OK (7 queries)
11 Correct 1 ms 344 KB OK (4 queries)
12 Correct 1 ms 344 KB OK (5 queries)
13 Correct 1 ms 448 KB OK (8 queries)
14 Correct 0 ms 448 KB OK (10 queries)
15 Correct 0 ms 456 KB OK (7 queries)
16 Correct 1 ms 448 KB OK (19 queries)
17 Correct 0 ms 344 KB OK (2 queries)
18 Correct 0 ms 344 KB OK (10 queries)
19 Incorrect 0 ms 344 KB Wrong guess
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB OK (5 queries)
2 Correct 1 ms 456 KB OK (5 queries)
3 Correct 1 ms 344 KB OK (6 queries)
4 Correct 1 ms 344 KB OK (14 queries)
5 Correct 0 ms 344 KB OK (9 queries)
6 Correct 1 ms 456 KB OK (15 queries)
7 Correct 1 ms 448 KB OK (10 queries)
8 Correct 0 ms 344 KB OK (6 queries)
9 Correct 0 ms 452 KB OK (6 queries)
10 Correct 0 ms 344 KB OK (7 queries)
11 Correct 1 ms 344 KB OK (4 queries)
12 Correct 1 ms 344 KB OK (5 queries)
13 Correct 1 ms 448 KB OK (8 queries)
14 Correct 0 ms 448 KB OK (10 queries)
15 Correct 0 ms 456 KB OK (7 queries)
16 Correct 1 ms 448 KB OK (19 queries)
17 Correct 0 ms 344 KB OK (2 queries)
18 Correct 0 ms 344 KB OK (10 queries)
19 Incorrect 0 ms 344 KB Wrong guess
20 Halted 0 ms 0 KB -