Submission #750772

# Submission time Handle Problem Language Result Execution time Memory
750772 2023-05-30T09:29:53 Z edogawa_something Mađioničar (COI22_madionicar) C++17
100 / 100
1972 ms 320 KB
#include<bits/stdc++.h>
#include<chrono>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef string str;
typedef bool bl;
typedef vector<ll> vii;
typedef pair<ll,ll> pii;
typedef vector<pii> vpi;
#define ordered_set tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update>
#define fast ios_base::sync_with_stdio(0);cin.tie();
#define test ll qqqqq;cin>>qqqqq;while(qqqqq--)
#define test1 ll qqqqq=1;while(qqqqq--)
#define F first
#define S second
#define forn(i,n) for(int i=0;i<n;i++)
#define forx(i,j,n) for(int i=j;i<n;i++)
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define all(v) v.begin(),v.end()
#define lb lower_bound
#define ub upper_bound
#define pow powww
#define prtll(x) printf("%lld",x)
#define prtld(x) printf("%Lf",x)
#define prtst(x) printf("%s",x)
#define prtch(x) printf("%c",x)
#define measure chrono::high_resolution_clock::now()
#define duration chrono::duration_cast<chrono::milliseconds>(end-start)
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
const ll dx[]{1,0,-1,0,1,-1,1,-1};
const ll dy[]{0,-1,0,1,1,-1,-1,1};
const ll inf=1e18;
const ll mod=1e9+7;
const ll LM=1e8+1;
const ll M=2e5+10;
const ll MM=4002;
const ll MMM=501;
const ld pi=acos(-1);
//const ll mod=998244353;
ll pow(ll r,ll to,ll m=mod){
  ll res=1;
  r%=m;
  while(to){
    if((to&1)){
      res*=r,res%=m;
    }
    r*=r,r%=m;
    to=(to>>1);
  }
  return res;
}
ll n,a[M],ma=1;
bl chk(ll lef,ll righ){
  cout<<"? "<<lef<<' '<<righ<<endl;
  bl c;
  cin>>c;
  return c;
}
int main(){
  fast
  //freopen("gen.txt","r",stdin);
  auto start=measure;
  test1{
    cin>>n;
    forn(i,n){
      ll l=i-(ma+1)/2,r=i+(ma+1)/2;
      while(l>=0&&r<n){
        if(!chk(l+1,r+1))
        break;
        l--,r++;
      }
      ma=max(ma,r-l-1);
    }
    forn(i,n-1){
      ll l=i-ma/2,r=i+ma/2+1;
      while(l>=0&&r<n){
        if(!chk(l+1,r+1))
        break;
        l--,r++;
      }
      ma=max(ma,r-l-1);
    }
    cout<<"! "<<ma<<endl;
  }
  auto end=measure;
  auto dur=duration;
  //cout<<fixed<<dur.count()<<'\n';
  return 0;
}
/*
*/
# Verdict Execution time Memory Grader output
1 Correct 122 ms 320 KB Output is correct
2 Correct 124 ms 208 KB Output is correct
3 Correct 112 ms 208 KB Output is correct
4 Correct 133 ms 208 KB Output is correct
5 Correct 138 ms 208 KB Output is correct
6 Correct 107 ms 208 KB Output is correct
7 Correct 70 ms 208 KB Output is correct
8 Correct 85 ms 208 KB Output is correct
9 Correct 87 ms 208 KB Output is correct
10 Correct 151 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 122 ms 320 KB Output is correct
2 Correct 124 ms 208 KB Output is correct
3 Correct 112 ms 208 KB Output is correct
4 Correct 133 ms 208 KB Output is correct
5 Correct 138 ms 208 KB Output is correct
6 Correct 107 ms 208 KB Output is correct
7 Correct 70 ms 208 KB Output is correct
8 Correct 85 ms 208 KB Output is correct
9 Correct 87 ms 208 KB Output is correct
10 Correct 151 ms 208 KB Output is correct
11 Correct 973 ms 208 KB Output is correct
12 Correct 1111 ms 208 KB Output is correct
13 Correct 1054 ms 208 KB Output is correct
14 Correct 847 ms 208 KB Output is correct
15 Correct 916 ms 208 KB Output is correct
16 Correct 640 ms 208 KB Output is correct
17 Correct 440 ms 208 KB Output is correct
18 Correct 1056 ms 208 KB Output is correct
19 Correct 546 ms 208 KB Output is correct
20 Correct 898 ms 208 KB Output is correct
21 Correct 903 ms 208 KB Output is correct
22 Correct 1024 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1810 ms 208 KB Output is correct
2 Correct 357 ms 208 KB Output is correct
3 Correct 1536 ms 208 KB Output is correct
4 Correct 804 ms 208 KB Output is correct
5 Correct 773 ms 208 KB Output is correct
6 Correct 1645 ms 256 KB Output is correct
7 Correct 721 ms 208 KB Output is correct
8 Correct 1010 ms 208 KB Output is correct
9 Correct 1690 ms 208 KB Output is correct
10 Correct 1254 ms 292 KB Output is correct
11 Correct 855 ms 208 KB Output is correct
12 Correct 738 ms 208 KB Output is correct
13 Correct 1170 ms 208 KB Output is correct
14 Correct 1522 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 122 ms 320 KB Output is correct
2 Correct 124 ms 208 KB Output is correct
3 Correct 112 ms 208 KB Output is correct
4 Correct 133 ms 208 KB Output is correct
5 Correct 138 ms 208 KB Output is correct
6 Correct 107 ms 208 KB Output is correct
7 Correct 70 ms 208 KB Output is correct
8 Correct 85 ms 208 KB Output is correct
9 Correct 87 ms 208 KB Output is correct
10 Correct 151 ms 208 KB Output is correct
11 Correct 973 ms 208 KB Output is correct
12 Correct 1111 ms 208 KB Output is correct
13 Correct 1054 ms 208 KB Output is correct
14 Correct 847 ms 208 KB Output is correct
15 Correct 916 ms 208 KB Output is correct
16 Correct 640 ms 208 KB Output is correct
17 Correct 440 ms 208 KB Output is correct
18 Correct 1056 ms 208 KB Output is correct
19 Correct 546 ms 208 KB Output is correct
20 Correct 898 ms 208 KB Output is correct
21 Correct 903 ms 208 KB Output is correct
22 Correct 1024 ms 208 KB Output is correct
23 Correct 1810 ms 208 KB Output is correct
24 Correct 357 ms 208 KB Output is correct
25 Correct 1536 ms 208 KB Output is correct
26 Correct 804 ms 208 KB Output is correct
27 Correct 773 ms 208 KB Output is correct
28 Correct 1645 ms 256 KB Output is correct
29 Correct 721 ms 208 KB Output is correct
30 Correct 1010 ms 208 KB Output is correct
31 Correct 1690 ms 208 KB Output is correct
32 Correct 1254 ms 292 KB Output is correct
33 Correct 855 ms 208 KB Output is correct
34 Correct 738 ms 208 KB Output is correct
35 Correct 1170 ms 208 KB Output is correct
36 Correct 1522 ms 208 KB Output is correct
37 Correct 1047 ms 208 KB Output is correct
38 Correct 1316 ms 208 KB Output is correct
39 Correct 1453 ms 208 KB Output is correct
40 Correct 1299 ms 208 KB Output is correct
41 Correct 1744 ms 208 KB Output is correct
42 Correct 1057 ms 208 KB Output is correct
43 Correct 787 ms 208 KB Output is correct
44 Correct 1651 ms 208 KB Output is correct
45 Correct 556 ms 208 KB Output is correct
46 Correct 1519 ms 208 KB Output is correct
47 Correct 1518 ms 320 KB Output is correct
48 Correct 1661 ms 208 KB Output is correct
49 Correct 891 ms 208 KB Output is correct
50 Correct 1079 ms 320 KB Output is correct
51 Correct 1972 ms 208 KB Output is correct
52 Correct 1794 ms 208 KB Output is correct