Submission #922012

# Submission time Handle Problem Language Result Execution time Memory
922012 2024-02-04T17:08:54 Z owoovo Colors (BOI20_colors) C++14
0 / 100
0 ms 436 KB
#include <bits/stdc++.h>
#pragma GCC opimize("unroll-loops,O3")
#pragma GCC target("avx2")
#define int long long
#define F first 
#define S second
using namespace std;
vector<int> use;
int query(int pos){
    cout<<"? "<<pos<<endl;
    int a;
    cin>>a;
    return a;
}
signed main(){
    int l=1,r;
    cin>>r;
    while(l!=r){
        int m=(l+r)/2;
        use.push_back(m);
        l=m+1;
    }
    int b=1,mn=0,npos=0;
    for(auto x:use){
        npos+=x*(2*b-1);
        cout<<npos<<"\n";
        mn=min(mn,npos);
        b^=1;
    }
    mn=abs(mn)+1;
    query(mn);
    b=1;
    l=1;
    npos=mn;
    while(l!=r){
        int m=(l+r-1)/2;
        npos+=m*(2*b-1);
        b^=1;
        if(query(npos)){
            r=m;
        }else{
            l=m+1;
        }
    }
    cout<<"= "<<l<<endl;
    return 0;
}

Compilation message

Colors.cpp:2: warning: ignoring '#pragma GCC opimize' [-Wunknown-pragmas]
    2 | #pragma GCC opimize("unroll-loops,O3")
      |
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 436 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 436 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 436 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 436 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 436 KB Execution killed with signal 13
2 Halted 0 ms 0 KB -