Submission #258728

# Submission time Handle Problem Language Result Execution time Memory
258728 2020-08-06T12:47:39 Z sckmd Colors (BOI20_colors) C++14
0 / 100
0 ms 256 KB
    #include <bits/stdc++.h>
     
    using namespace std;
    typedef long long ll;
    map <ll,bool> bio;
     
    int main()
    {
      int n;
      cin >> n;
      int mx = 62;
      ll ans = 0LL;
      cout << "? 1\n";
      bio[1]=true;
      ll lastask = 1;
      for(int i = mx; i >= 0; i--)
      {
        ll now = ans + (1LL<<i);
        if(lastask-now > 1 && !bio[lastask-now])
        {
          cout << "? " << lastask-now << "\n";
          int rez;
          cin >> rez;
          if(rez==1)
          {
            bio[lastask-now]=true;
            lastask -= now;
            continue;
          }
          else
          {
            bio[lastask-now]=true;
            ans += (1LL<<i);
            lastask -= now;
            continue;
          }
        }
        if(lastask+now <= n && !bio[lastask+now])
        {
          cout << "? " << lastask+now << "\n";
          int rez;
          cin >> rez;
          lastask += now;
          bio[lastask]=true;
          if(rez==0)
          {
            ans += (1LL<<i);
          }
        }
      }
      cout << "= " << ans+1;
      return 0;
    }
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Wrong guess
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Wrong guess
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Wrong guess
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Wrong guess
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Wrong guess
2 Halted 0 ms 0 KB -