//#ifndef LOCAL
//#pragma GCC optimize ("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#endif
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using indexed_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define vecm(a,n,m) vector<vector<int>>a(n,vector<int>(m,0));
#define int int64_t
#define pii pair<int,int>
#define vi vector
#define vii vector<pii>
#define mpii map<int,int>
#define lb lower_bound
#define ub upper_bound
#define foor(i,a,b) for(int i=a;i<b; i++)
#define foor(i,a) foor(i,0,a)
#define ss second
#define ff first
#define ln(x) int(x.size())
#define all(x) (x).begin(), (x).end()
#define seea(a,n) for(int i=0;i<n;i++){cin>>a[i];}
const int mod = 1E9+7;
const int MAXN=200000;
const int inf=1e18;
const int LOG=21;
void solution(){
int n;
cin >> n;
int l=1,r=n;
while(l<r){
int mid=(l+r)/2;
cout << "? " << 1 << endl;
int a,b;
cin >> a;
cout << "? " << mid+1 << endl;
cin >> b;
if(b)r=mid;
else l=mid+1;
}
cout << "= " << l << endl;
}
int32_t main(){
clock_t tStart = clock();
std::ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int q = 1; // cin >> q;
while(q--) {
solution();
cout << '\n';
}
cerr<<fixed<<setprecision(3)<<"\nTime Taken: "<<(double)(clock()- tStart)/CLOCKS_PER_SEC << " ms" << endl;
}
/*
██╗░░██╗██╗░░██╗░█████╗░░██████╗░░░░░░░█████╗░░░███╗░░░█████╗░
██║░██╔╝██║░░██║██╔══██╗██╔════╝░░░░░░██╔══██╗░████║░░██╔══██╗
█████═╝░███████║██║░░██║╚█████╗░█████╗██║░░██║██╔██║░░╚██████║
██╔═██╗░██╔══██║██║░░██║░╚═══██╗╚════╝██║░░██║╚═╝██║░░░╚═══██║
██║░╚██╗██║░░██║╚█████╔╝██████╔╝░░░░░░╚█████╔╝███████╗░█████╔╝
╚═╝░░╚═╝╚═╝░░╚═╝░╚════╝░╚═════╝░░░░░░░░╚════╝░╚══════╝░╚════╝░
*/
Compilation message
Colors.cpp:22: warning: "foor" redefined
22 | #define foor(i,a) foor(i,0,a)
|
Colors.cpp:21: note: this is the location of the previous definition
21 | #define foor(i,a,b) for(int i=a;i<b; i++)
|
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Hair color 1 was used multiple times |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Hair color 1 was used multiple times |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Hair color 1 was used multiple times |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Hair color 1 was used multiple times |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Hair color 1 was used multiple times |
2 |
Halted |
0 ms |
0 KB |
- |