Submission #956234

#TimeUsernameProblemLanguageResultExecution timeMemory
956234ZeroCoolMađioničar (COI22_madionicar)C++14
100 / 100
1093 ms504 KiB
#include <bits/stdc++.h> #include <chrono> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; template <typename T > using oset = tree < T, null_type, less < T > , rb_tree_tag, tree_order_statistics_node_update > ; #define int long long #define pb push_back #define mp make_pair #define mt make_tuple #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() //#define endl '\n' using ll = long long; using ld = long double; #define send ios::sync_with_stdio(false); #define help cin.tie(0); void solve(int T); const int N = 1e5 + 10; const int M = 405; const int SQRT = sqrt(N); const int LOG = 20; const int INF = 1e18; const int MOD = 45678; const ld EPS = 1e-9; int ans; int n, m, q, l, r, x, y, mx, mn; int32_t main(){ send help; solve(1); } bool ask(int l,int r){ if(l < 0 || r >= n)return 0; cout<<"? "<<l+1<<" "<<r+1<<endl; bool a; cin>>a; return a; } void answer(int x){ cout<<"! "<<x<<endl; exit(0); } void solve(int T){ cin>>n; int o = 0; int e = 0; for(int i = 0;i<n;i++){ while(ask(i - o - 1, i + o + 1))o++; while(ask(i - e, i + e + 1))e++; } answer(max(o * 2 + 1, 2 * e)); } //Te molam da raboti !!
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...