Submission #914240

# Submission time Handle Problem Language Result Execution time Memory
914240 2024-01-21T12:19:13 Z edogawa_something Colors (BOI20_colors) C++17
0 / 100
1 ms 344 KB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vii;
typedef pair<ll,ll> pii;
#define F first
#define S second
#define pb push_back
#define all(v) v.begin(),v.end()
#define pow poww
const ll M=1e5+10;
const ll inf=2e18;
const ll mod=1e9+7;
ll pow(ll x,ll y){
  ll res=1;
  x%=mod; 
  while(y>0){
    if((y&1))
    res*=x,res%=mod;
    x*=x,x%=mod;
    y=(y>>1);
  }
  return res;
}
ll n,ans,cn;
bool ask(ll x){
  cout<<"? "<<x<<endl;
  bool c;
  cin>>c;
  return c;
}
void ret(ll x){
  cout<<"= "<<x<<endl;
}
int main(){
  ios_base::sync_with_stdio(0),cin.tie(0);
  ll TC=1;
  //cin>>TC;
  while(TC--){
    cin>>n;
    ask(1);
    ll cur=1;
    for(int i=n-1;i>=1;i--){
      if((n-i)%2==1){
      if(!ask(cur+i)){
        ret(i+1);
        return 0;
      }
      cur+=i;
      }
      else{
      if(!ask(cur-i)){
        ret(i+1);
        return 0;
      }
      cur-=i;
      }
    }
  }
  return 0;
}
/*

*/  
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB OK (5 queries)
2 Correct 1 ms 344 KB OK (6 queries)
3 Correct 1 ms 344 KB OK (10 queries)
4 Incorrect 1 ms 344 KB Unexpected end of file - token expected
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB OK (5 queries)
2 Correct 1 ms 344 KB OK (6 queries)
3 Correct 1 ms 344 KB OK (10 queries)
4 Incorrect 1 ms 344 KB Unexpected end of file - token expected
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB OK (5 queries)
2 Correct 1 ms 344 KB OK (6 queries)
3 Correct 1 ms 344 KB OK (10 queries)
4 Incorrect 1 ms 344 KB Unexpected end of file - token expected
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB OK (5 queries)
2 Correct 1 ms 344 KB OK (6 queries)
3 Correct 1 ms 344 KB OK (10 queries)
4 Incorrect 1 ms 344 KB Unexpected end of file - token expected
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB OK (5 queries)
2 Correct 1 ms 344 KB OK (6 queries)
3 Correct 1 ms 344 KB OK (10 queries)
4 Incorrect 1 ms 344 KB Unexpected end of file - token expected
5 Halted 0 ms 0 KB -