답안 #709321

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
709321 2023-03-13T11:03:16 Z groshi Gap (APIO16_gap) C++17
100 / 100
47 ms 1872 KB
#include<iostream>
#include "gap.h"
#define int long long
using namespace std;
long long a[200000];
long long findGap(int32_t t,int32_t n)
{
    if(t==1)
    {
        int l,r;
        MinMax(0,(long long)1e18,&l,&r);
        a[1]=l;
        a[n]=r;
        int pocz=2,kon=n-1;
        while(pocz<=kon)
        {
            MinMax(a[pocz-1]+1,a[kon+1]-1,&l,&r);
            a[pocz]=l;
            a[kon]=r;
            pocz++;
            kon--;
        }
        long long wynik=0;
        for(int i=1;i<n;i++)
            wynik=max(wynik,a[i+1]-a[i]);
        return wynik;
    }
    else{
        int l,r;
        MinMax(0,(long long)1e18,&l,&r);
        int koncowka=r;
        int srednia=(r-l)-1;
        srednia/=(n-1);
        srednia++;
        int kon=l+srednia;
        for(int pocz=l;pocz<koncowka;)
        {
            if(kon<=pocz)
                kon=pocz+srednia;
            MinMax(pocz+1,kon,&l,&r);
            if(l==-1)
                kon+=srednia;
            else{
                srednia=max(srednia,l-pocz);
                pocz=r;
                kon=pocz+srednia;
            }
        }
        return srednia;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 0 ms 208 KB Output is correct
7 Correct 0 ms 336 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 10 ms 684 KB Output is correct
17 Correct 11 ms 632 KB Output is correct
18 Correct 11 ms 688 KB Output is correct
19 Correct 9 ms 680 KB Output is correct
20 Correct 8 ms 684 KB Output is correct
21 Correct 45 ms 1868 KB Output is correct
22 Correct 43 ms 1816 KB Output is correct
23 Correct 38 ms 1752 KB Output is correct
24 Correct 40 ms 1856 KB Output is correct
25 Correct 36 ms 1872 KB Output is correct
26 Correct 39 ms 1828 KB Output is correct
27 Correct 35 ms 1816 KB Output is correct
28 Correct 37 ms 1788 KB Output is correct
29 Correct 46 ms 1828 KB Output is correct
30 Correct 38 ms 1812 KB Output is correct
31 Correct 0 ms 336 KB Output is correct
32 Correct 0 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 0 ms 208 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 0 ms 208 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 1 ms 208 KB Output is correct
10 Correct 0 ms 208 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 7 ms 464 KB Output is correct
17 Correct 6 ms 464 KB Output is correct
18 Correct 6 ms 428 KB Output is correct
19 Correct 6 ms 468 KB Output is correct
20 Correct 5 ms 508 KB Output is correct
21 Correct 26 ms 1056 KB Output is correct
22 Correct 23 ms 1020 KB Output is correct
23 Correct 23 ms 968 KB Output is correct
24 Correct 23 ms 1096 KB Output is correct
25 Correct 47 ms 1024 KB Output is correct
26 Correct 26 ms 1080 KB Output is correct
27 Correct 23 ms 1064 KB Output is correct
28 Correct 24 ms 1056 KB Output is correct
29 Correct 24 ms 972 KB Output is correct
30 Correct 21 ms 1104 KB Output is correct
31 Correct 0 ms 208 KB Output is correct
32 Correct 0 ms 208 KB Output is correct