답안 #23318

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
23318 2017-05-06T09:13:16 Z duongthoi1999 Gap (APIO16_gap) C++14
0 / 100
36 ms 7496 KB
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef long double ld;
typedef pair<ll, int> ii;
const int mod = (int) 1e9 + 7;
const ll inf = 1LL << 60;
const int maxn = (int) 1e5 + 5;
const ld eps = 1e-9;

vector<ll> a, b;
int l[maxn], r[maxn];

ll findGap(int T, int N) {
	a.resize(N + 1, 0);
	b.resize(N + 1, 0);
	MinMax(0, inf, &a[0], &a[N]);
	b[0] = a[0]; b[N] = a[N];
	ll len = a[N] - a[0] - 1;
    int g = min(len, 1LL * N - 1);
    int sg = len % g;
    int bg = g - sg;
    l[0] = r[0] = a[0];
    a[g + 1] = a[N];
    b[g + 1] = b[N];
    rep(i, 1, g + 1) {
        l[i] = r[i - 1] + 1;
        if(i <= sg) r[i] = l[i] + (len / g) - 1;
        else r[i] = l[i] + (len / g);
        MinMax(l[i], r[i], &a[i], &b[i]);
    }
    ll res = 1;
    int j = 0;
    rep(i, 0, g + 2) {
        res = max(res, a[i] - b[j]);
        if(a[i] == -1 && b[i] == -1) continue;
        j = i;
    }
	return res;
}

Compilation message

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:30:9: warning: unused variable 'bg' [-Wunused-variable]
     int bg = g - sg;
         ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 5928 KB Unexpected end of file - int64 expected
2 Incorrect 0 ms 5928 KB Unexpected end of file - int64 expected
3 Incorrect 0 ms 5928 KB Unexpected end of file - int64 expected
4 Incorrect 0 ms 5928 KB Unexpected end of file - int64 expected
5 Incorrect 0 ms 5928 KB Output isn't correct
6 Incorrect 0 ms 5928 KB Unexpected end of file - int64 expected
7 Incorrect 0 ms 5928 KB Unexpected end of file - int64 expected
8 Incorrect 0 ms 5928 KB Unexpected end of file - int64 expected
9 Incorrect 0 ms 5928 KB Unexpected end of file - int64 expected
10 Incorrect 0 ms 5928 KB Output isn't correct
11 Incorrect 0 ms 5928 KB Unexpected end of file - int64 expected
12 Incorrect 0 ms 5928 KB Unexpected end of file - int64 expected
13 Incorrect 0 ms 5928 KB Unexpected end of file - int64 expected
14 Incorrect 0 ms 5928 KB Unexpected end of file - int64 expected
15 Incorrect 0 ms 5928 KB Unexpected end of file - int64 expected
16 Incorrect 3 ms 6320 KB Unexpected end of file - int64 expected
17 Incorrect 6 ms 6320 KB Unexpected end of file - int64 expected
18 Incorrect 6 ms 6320 KB Unexpected end of file - int64 expected
19 Incorrect 6 ms 6320 KB Unexpected end of file - int64 expected
20 Incorrect 6 ms 6320 KB Output isn't correct
21 Incorrect 26 ms 7496 KB Unexpected end of file - int64 expected
22 Incorrect 23 ms 7496 KB Unexpected end of file - int64 expected
23 Incorrect 29 ms 7496 KB Unexpected end of file - int64 expected
24 Incorrect 26 ms 7496 KB Unexpected end of file - int64 expected
25 Incorrect 19 ms 7496 KB Unexpected end of file - int64 expected
26 Incorrect 26 ms 7496 KB Unexpected end of file - int64 expected
27 Incorrect 33 ms 7496 KB Unexpected end of file - int64 expected
28 Incorrect 26 ms 7496 KB Unexpected end of file - int64 expected
29 Incorrect 26 ms 7496 KB Unexpected end of file - int64 expected
30 Incorrect 33 ms 7496 KB Output isn't correct
31 Incorrect 0 ms 5928 KB Unexpected end of file - int64 expected
32 Incorrect 0 ms 5928 KB Unexpected end of file - int64 expected
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 5928 KB Unexpected end of file - int64 expected
2 Incorrect 0 ms 5928 KB Unexpected end of file - int64 expected
3 Incorrect 0 ms 5928 KB Unexpected end of file - int64 expected
4 Incorrect 0 ms 5928 KB Unexpected end of file - int64 expected
5 Correct 0 ms 5928 KB Output is correct
6 Incorrect 0 ms 5928 KB Unexpected end of file - int64 expected
7 Incorrect 0 ms 5928 KB Unexpected end of file - int64 expected
8 Incorrect 0 ms 5928 KB Unexpected end of file - int64 expected
9 Incorrect 0 ms 5928 KB Unexpected end of file - int64 expected
10 Correct 0 ms 5928 KB Output is correct
11 Incorrect 0 ms 5928 KB Unexpected end of file - int64 expected
12 Incorrect 0 ms 5928 KB Unexpected end of file - int64 expected
13 Incorrect 0 ms 5928 KB Unexpected end of file - int64 expected
14 Incorrect 0 ms 5928 KB Unexpected end of file - int64 expected
15 Incorrect 0 ms 5928 KB Unexpected end of file - int64 expected
16 Incorrect 6 ms 6320 KB Unexpected end of file - int64 expected
17 Incorrect 6 ms 6320 KB Unexpected end of file - int64 expected
18 Incorrect 6 ms 6320 KB Unexpected end of file - int64 expected
19 Incorrect 6 ms 6320 KB Unexpected end of file - int64 expected
20 Correct 6 ms 6320 KB Output is correct
21 Incorrect 26 ms 7496 KB Unexpected end of file - int64 expected
22 Incorrect 26 ms 7496 KB Unexpected end of file - int64 expected
23 Incorrect 33 ms 7496 KB Unexpected end of file - int64 expected
24 Incorrect 26 ms 7496 KB Unexpected end of file - int64 expected
25 Incorrect 23 ms 7496 KB Unexpected end of file - int64 expected
26 Incorrect 23 ms 7496 KB Unexpected end of file - int64 expected
27 Incorrect 23 ms 7496 KB Unexpected end of file - int64 expected
28 Incorrect 29 ms 7496 KB Unexpected end of file - int64 expected
29 Incorrect 26 ms 7496 KB Unexpected end of file - int64 expected
30 Correct 36 ms 7496 KB Output is correct
31 Incorrect 0 ms 5928 KB Unexpected end of file - int64 expected
32 Incorrect 0 ms 5928 KB Unexpected end of file - int64 expected