Submission #779399

# Submission time Handle Problem Language Result Execution time Memory
779399 2023-07-11T11:33:42 Z groshi Mađioničar (COI22_madionicar) C++17
38 / 100
5000 ms 1456 KB
#include<bits/stdc++.h>
#define int long long
using namespace std;
int R[2][200000];
int32_t main()
{
    //cin.tie(0);
    //cout.tie(0);
    //ios_base::sync_with_stdio(0);
    int n;
    cin>>n;
    int maxx=0;
    int ile=0;
    for(int j=0;j<=1;j++)
    {
        R[j][0]=0;
        int rp=0;
        int i=1;
        while(i<=n)
        {
            while(i-rp-1>=1 && i+j+rp<=n)
            {
                if(ile>=200000)
                    while(true)
                        ile++;
                cout<<"? "<<i-rp-1<<" "<<i+j+rp<<"\n";
                ile++;
                int co;
                cin>>co;
                if(co==1)
                    rp++;
                else break;
            }
            R[j][i]=rp;
            int k=1;
            while((R[j][i-k]!=rp-k)&&(k<rp))
            {
                R[j][i+k]=min(R[j][i-k],rp-k);
                k++;
            }
            rp=max(rp-k,0LL);
            i+=k;
        }
    }
    for(int i=0;i<=1;i++)
        for(int j=0;j<=n;j++)
            maxx=max(maxx,R[i][j]*2+i);
    cout<<"! "<<maxx;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 133 ms 468 KB Output is correct
2 Correct 122 ms 316 KB Output is correct
3 Correct 98 ms 312 KB Output is correct
4 Correct 181 ms 572 KB Output is correct
5 Correct 182 ms 320 KB Output is correct
6 Correct 144 ms 556 KB Output is correct
7 Correct 117 ms 304 KB Output is correct
8 Correct 169 ms 496 KB Output is correct
9 Correct 147 ms 416 KB Output is correct
10 Correct 114 ms 476 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 133 ms 468 KB Output is correct
2 Correct 122 ms 316 KB Output is correct
3 Correct 98 ms 312 KB Output is correct
4 Correct 181 ms 572 KB Output is correct
5 Correct 182 ms 320 KB Output is correct
6 Correct 144 ms 556 KB Output is correct
7 Correct 117 ms 304 KB Output is correct
8 Correct 169 ms 496 KB Output is correct
9 Correct 147 ms 416 KB Output is correct
10 Correct 114 ms 476 KB Output is correct
11 Correct 1162 ms 1272 KB Output is correct
12 Correct 714 ms 1292 KB Output is correct
13 Correct 932 ms 1292 KB Output is correct
14 Correct 1012 ms 1256 KB Output is correct
15 Correct 1022 ms 1328 KB Output is correct
16 Correct 1192 ms 1304 KB Output is correct
17 Correct 1317 ms 1300 KB Output is correct
18 Correct 930 ms 1276 KB Output is correct
19 Correct 1187 ms 1432 KB Output is correct
20 Correct 1025 ms 1268 KB Output is correct
21 Correct 1000 ms 1456 KB Output is correct
22 Correct 688 ms 1308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5008 ms 1432 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 133 ms 468 KB Output is correct
2 Correct 122 ms 316 KB Output is correct
3 Correct 98 ms 312 KB Output is correct
4 Correct 181 ms 572 KB Output is correct
5 Correct 182 ms 320 KB Output is correct
6 Correct 144 ms 556 KB Output is correct
7 Correct 117 ms 304 KB Output is correct
8 Correct 169 ms 496 KB Output is correct
9 Correct 147 ms 416 KB Output is correct
10 Correct 114 ms 476 KB Output is correct
11 Correct 1162 ms 1272 KB Output is correct
12 Correct 714 ms 1292 KB Output is correct
13 Correct 932 ms 1292 KB Output is correct
14 Correct 1012 ms 1256 KB Output is correct
15 Correct 1022 ms 1328 KB Output is correct
16 Correct 1192 ms 1304 KB Output is correct
17 Correct 1317 ms 1300 KB Output is correct
18 Correct 930 ms 1276 KB Output is correct
19 Correct 1187 ms 1432 KB Output is correct
20 Correct 1025 ms 1268 KB Output is correct
21 Correct 1000 ms 1456 KB Output is correct
22 Correct 688 ms 1308 KB Output is correct
23 Execution timed out 5008 ms 1432 KB Time limit exceeded
24 Halted 0 ms 0 KB -