Submission #256039

# Submission time Handle Problem Language Result Execution time Memory
256039 2020-08-02T08:49:52 Z 반딧불(#5032) Colors (BOI20_colors) C++17
0 / 100
1 ms 512 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int qc;
bool noticed(ll x){
    qc++;
    if(qc > 64){
        exit(1);
    }
    cout << "? " << x << endl;
    bool ret;
    if(scanf("%d", &ret) != 1) exit(1);
    return ret;
}

void submit(ll x){
    cout << "= " << x << endl;
    exit(0);
}

ll n;
ll ans;

int main(){
    scanf("%lld", &n);
    ans = n;

    noticed(1);

    ll l = 2, r = n;
    ll lft = 0;
    while(l <= r){
        if(!lft){
            if(!noticed(r--)) submit(r-l+3);
        }
        else{
            if(!noticed(l++)) submit(r-l+3);
        }
        lft = !lft;
    }
    submit(1);
}

Compilation message

Colors.cpp: In function 'bool noticed(ll)':
Colors.cpp:15:24: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'bool*' [-Wformat=]
     if(scanf("%d", &ret) != 1) exit(1);
                    ~~~~^
Colors.cpp: In function 'int main()':
Colors.cpp:28:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld", &n);
     ~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -