답안 #47961

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
47961 2018-05-09T08:38:27 Z 3zp Gap (APIO16_gap) C++14
70 / 100
68 ms 1532 KB
#include "gap.h"
#define ll long long
#include<bits/stdc++.h>
using namespace std;
long long findGap(int T, int N)
{
    ll s, t;
    MinMax(0, 1e18, &s, &t);
    ll L = t - s;
    ll d = (L+N-2) / (N - 1);
    ll ans = d;
    d++;
    ll x = s;
    while(x != t){
        ll p, q;
        if(x + d >= t) break;
         MinMax(x + 1, x + d, &p , &q);
        if(q != -1) {
            ans = max(ans, x - p);
            x = q;
            continue;
        }
        int w = 2;
        while(1){

            MinMax(x + 1,min( x + w * d, (ll)1e18),&p , &q);
            if(q == -1) {w++; continue;}
            ans = max(ans, p - x);
            d = ans;
            x = q;
            break;
        }
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 488 KB Output isn't correct
3 Correct 3 ms 488 KB Output is correct
4 Incorrect 2 ms 488 KB Output isn't correct
5 Incorrect 2 ms 656 KB Output isn't correct
6 Correct 2 ms 656 KB Output is correct
7 Correct 2 ms 656 KB Output is correct
8 Correct 2 ms 664 KB Output is correct
9 Correct 2 ms 664 KB Output is correct
10 Incorrect 2 ms 664 KB Output isn't correct
11 Correct 2 ms 664 KB Output is correct
12 Correct 2 ms 664 KB Output is correct
13 Correct 2 ms 664 KB Output is correct
14 Correct 2 ms 664 KB Output is correct
15 Incorrect 3 ms 664 KB Output isn't correct
16 Correct 11 ms 740 KB Output is correct
17 Correct 11 ms 740 KB Output is correct
18 Correct 11 ms 740 KB Output is correct
19 Correct 11 ms 740 KB Output is correct
20 Correct 7 ms 784 KB Output is correct
21 Correct 36 ms 1344 KB Output is correct
22 Correct 36 ms 1344 KB Output is correct
23 Correct 38 ms 1360 KB Output is correct
24 Correct 38 ms 1380 KB Output is correct
25 Incorrect 67 ms 1380 KB Output isn't correct
26 Correct 36 ms 1464 KB Output is correct
27 Correct 36 ms 1464 KB Output is correct
28 Correct 38 ms 1464 KB Output is correct
29 Correct 37 ms 1464 KB Output is correct
30 Correct 25 ms 1464 KB Output is correct
31 Correct 2 ms 1464 KB Output is correct
32 Incorrect 2 ms 1464 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1464 KB Output is correct
2 Correct 2 ms 1464 KB Output is correct
3 Correct 2 ms 1464 KB Output is correct
4 Correct 2 ms 1464 KB Output is correct
5 Correct 2 ms 1464 KB Output is correct
6 Correct 2 ms 1464 KB Output is correct
7 Correct 2 ms 1464 KB Output is correct
8 Correct 2 ms 1464 KB Output is correct
9 Correct 2 ms 1464 KB Output is correct
10 Correct 2 ms 1464 KB Output is correct
11 Correct 2 ms 1464 KB Output is correct
12 Correct 2 ms 1464 KB Output is correct
13 Correct 3 ms 1464 KB Output is correct
14 Correct 2 ms 1464 KB Output is correct
15 Correct 3 ms 1464 KB Output is correct
16 Correct 11 ms 1464 KB Output is correct
17 Correct 12 ms 1464 KB Output is correct
18 Correct 12 ms 1464 KB Output is correct
19 Correct 11 ms 1464 KB Output is correct
20 Correct 7 ms 1464 KB Output is correct
21 Correct 36 ms 1464 KB Output is correct
22 Correct 37 ms 1464 KB Output is correct
23 Correct 36 ms 1464 KB Output is correct
24 Correct 36 ms 1464 KB Output is correct
25 Correct 68 ms 1464 KB Output is correct
26 Correct 38 ms 1532 KB Output is correct
27 Correct 36 ms 1532 KB Output is correct
28 Correct 36 ms 1532 KB Output is correct
29 Correct 36 ms 1532 KB Output is correct
30 Correct 28 ms 1532 KB Output is correct
31 Correct 2 ms 1532 KB Output is correct
32 Correct 2 ms 1532 KB Output is correct