답안 #914239

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
914239 2024-01-21T12:14:36 Z Abito Colors (BOI20_colors) C++14
0 / 100
1 ms 344 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 n,c=1;
int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    cin>>n;
    set<int> s;
    for (int i=1;i<=n;i++) s.ep(i);
    int l=1,r=n-1,mid;bool h;
    while (l<=r){
        mid=(l+r)/2;
        for (int i=n;i;i--){
            if (!s.count(i) || !s.count(i+mid)) continue;
            cout<<"? "<<i<<endl;cin>>h;
            cout<<"? "<<i+mid<<endl;cin>>h;
            s.erase(i);
            s.erase(i+mid);
            break;
        }
        if (!h){
            c=mid+1;
            l=mid+1;
        }else r=mid-1;
    }cout<<"= "<<c<<endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB OK (4 queries)
2 Correct 0 ms 344 KB OK (10 queries)
3 Correct 1 ms 344 KB OK (6 queries)
4 Correct 1 ms 344 KB OK (8 queries)
5 Correct 1 ms 344 KB OK (8 queries)
6 Correct 0 ms 344 KB OK (12 queries)
7 Correct 1 ms 344 KB OK (12 queries)
8 Incorrect 0 ms 344 KB Wrong guess
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB OK (4 queries)
2 Correct 0 ms 344 KB OK (10 queries)
3 Correct 1 ms 344 KB OK (6 queries)
4 Correct 1 ms 344 KB OK (8 queries)
5 Correct 1 ms 344 KB OK (8 queries)
6 Correct 0 ms 344 KB OK (12 queries)
7 Correct 1 ms 344 KB OK (12 queries)
8 Incorrect 0 ms 344 KB Wrong guess
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB OK (4 queries)
2 Correct 0 ms 344 KB OK (10 queries)
3 Correct 1 ms 344 KB OK (6 queries)
4 Correct 1 ms 344 KB OK (8 queries)
5 Correct 1 ms 344 KB OK (8 queries)
6 Correct 0 ms 344 KB OK (12 queries)
7 Correct 1 ms 344 KB OK (12 queries)
8 Incorrect 0 ms 344 KB Wrong guess
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB OK (4 queries)
2 Correct 0 ms 344 KB OK (10 queries)
3 Correct 1 ms 344 KB OK (6 queries)
4 Correct 1 ms 344 KB OK (8 queries)
5 Correct 1 ms 344 KB OK (8 queries)
6 Correct 0 ms 344 KB OK (12 queries)
7 Correct 1 ms 344 KB OK (12 queries)
8 Incorrect 0 ms 344 KB Wrong guess
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB OK (4 queries)
2 Correct 0 ms 344 KB OK (10 queries)
3 Correct 1 ms 344 KB OK (6 queries)
4 Correct 1 ms 344 KB OK (8 queries)
5 Correct 1 ms 344 KB OK (8 queries)
6 Correct 0 ms 344 KB OK (12 queries)
7 Correct 1 ms 344 KB OK (12 queries)
8 Incorrect 0 ms 344 KB Wrong guess
9 Halted 0 ms 0 KB -