답안 #910441

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
910441 2024-01-18T05:08:02 Z ibm2006 Gap (APIO16_gap) C++17
30 / 100
48 ms 3444 KB
#include "gap.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll n,s,l,r,x,y,z,w,a[1100000],i,j,k,m,mx,gap;
long long findGap(int T, int N)
{
    n=N;
    if(T==1)
    {
        l=0;
        r=1e18-1;
        x=1;
        y=n;
        while(l<r)
        {
            MinMax(l,r,&l,&r);
            a[x]=l;
            a[y]=r;
            x++;
            y--;
            if(l==r||x>y)
                break;
            l++;
            r--;
        }
        for(i=1;i<n;i++)
        {
            s=max(s,a[i+1]-a[i]);
        }
        return s;
    }
    l=0;
    r=1e18-1;
    MinMax(l,r,&x,&y);
	gap=(y-x)/(n-1);
	l=x+1;
	mx=l;
	while(1)
    {
        r=min(l+gap-1,y-1);
        //printf("(%lld,%lld)\n",l,r);
        MinMax(l,r,&z,&w);
        if(z==-1)
        {
            l+=gap;
            if(l>=y)
                break;
            continue;
        }
        s=max(s,z-mx);
        mx=w;
        l+=gap;
        if(l>=y)
            break;
    }
    s=max(s,r-mx);
    return s;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 352 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 8 ms 2860 KB Output is correct
17 Correct 8 ms 2676 KB Output is correct
18 Correct 8 ms 2696 KB Output is correct
19 Correct 11 ms 2696 KB Output is correct
20 Correct 7 ms 2664 KB Output is correct
21 Correct 30 ms 3256 KB Output is correct
22 Correct 30 ms 3256 KB Output is correct
23 Correct 30 ms 3444 KB Output is correct
24 Correct 34 ms 3416 KB Output is correct
25 Correct 29 ms 3236 KB Output is correct
26 Correct 32 ms 3268 KB Output is correct
27 Correct 30 ms 3260 KB Output is correct
28 Correct 30 ms 3264 KB Output is correct
29 Correct 30 ms 3352 KB Output is correct
30 Correct 26 ms 3232 KB Output is correct
31 Correct 1 ms 344 KB Output is correct
32 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 10 ms 812 KB Output is correct
17 Correct 10 ms 640 KB Output is correct
18 Correct 10 ms 660 KB Output is correct
19 Correct 12 ms 648 KB Output is correct
20 Partially correct 5 ms 616 KB Partially correct
21 Correct 41 ms 1208 KB Output is correct
22 Correct 41 ms 1212 KB Output is correct
23 Correct 42 ms 1212 KB Output is correct
24 Correct 41 ms 1212 KB Output is correct
25 Correct 39 ms 1204 KB Output is correct
26 Correct 48 ms 1292 KB Output is correct
27 Correct 44 ms 1216 KB Output is correct
28 Correct 42 ms 1220 KB Output is correct
29 Correct 41 ms 1204 KB Output is correct
30 Partially correct 26 ms 1124 KB Partially correct
31 Incorrect 1 ms 344 KB Output isn't correct
32 Incorrect 0 ms 344 KB Output isn't correct