답안 #48376

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
48376 2018-05-12T10:05:51 Z BThero Gap (APIO16_gap) C++17
0 / 100
28 ms 1512 KB
#include <bits/stdc++.h>
#include "gap.h"

#define pb push_back
#define all(x) (x).begin(), (x).end()

typedef long long ll;

using namespace std;

long long findGap(int T, int N) {
    vector <ll> a, b;

    a.pb(0);
    b.pb((ll)1e18 + 1);

    while (a.size() + b.size() < N) {
        ll *v1, *v2;

        MinMax(a.back() + 1, b.back() - 1, v1, v2);

        a.pb(*v1); b.pb(*v2);
    }

    reverse(all(b));

    for (auto it : b) {
        a.pb(it);
    }

    sort(all(a));
    a.resize(unique(all(a)) - a.begin());

    ll ret = 0;

    for (int i = 0; i + 1 < a.size(); ++i) {
        ret = max(ret, a[i + 1] - a[i]);
    }

	return ret;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:17:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while (a.size() + b.size() < N) {
            ~~~~~~~~~~~~~~~~~~~~^~~
gap.cpp:36:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i + 1 < a.size(); ++i) {
                     ~~~~~~^~~~~~~~~~
gap.cpp:20:15: warning: 'v1' may be used uninitialized in this function [-Wmaybe-uninitialized]
         MinMax(a.back() + 1, b.back() - 1, v1, v2);
         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
gap.cpp:20:15: warning: 'v2' may be used uninitialized in this function [-Wmaybe-uninitialized]
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Runtime error 2 ms 376 KB Execution failed because the return code was nonzero
3 Runtime error 2 ms 428 KB Execution failed because the return code was nonzero
4 Runtime error 2 ms 428 KB Execution failed because the return code was nonzero
5 Runtime error 2 ms 428 KB Execution failed because the return code was nonzero
6 Runtime error 2 ms 428 KB Execution failed because the return code was nonzero
7 Runtime error 2 ms 428 KB Execution failed because the return code was nonzero
8 Runtime error 2 ms 428 KB Execution failed because the return code was nonzero
9 Runtime error 2 ms 480 KB Execution failed because the return code was nonzero
10 Runtime error 2 ms 480 KB Execution failed because the return code was nonzero
11 Runtime error 2 ms 480 KB Execution failed because the return code was nonzero
12 Runtime error 2 ms 512 KB Execution failed because the return code was nonzero
13 Runtime error 2 ms 512 KB Execution failed because the return code was nonzero
14 Runtime error 2 ms 512 KB Execution failed because the return code was nonzero
15 Runtime error 2 ms 512 KB Execution failed because the return code was nonzero
16 Runtime error 9 ms 640 KB Execution failed because the return code was nonzero
17 Runtime error 8 ms 640 KB Execution failed because the return code was nonzero
18 Runtime error 8 ms 688 KB Execution failed because the return code was nonzero
19 Runtime error 8 ms 688 KB Execution failed because the return code was nonzero
20 Runtime error 5 ms 688 KB Execution failed because the return code was nonzero
21 Runtime error 28 ms 1200 KB Execution failed because the return code was nonzero
22 Runtime error 28 ms 1200 KB Execution failed because the return code was nonzero
23 Runtime error 28 ms 1280 KB Execution failed because the return code was nonzero
24 Runtime error 28 ms 1280 KB Execution failed because the return code was nonzero
25 Runtime error 20 ms 1288 KB Execution failed because the return code was nonzero
26 Runtime error 28 ms 1392 KB Execution failed because the return code was nonzero
27 Runtime error 28 ms 1392 KB Execution failed because the return code was nonzero
28 Runtime error 28 ms 1432 KB Execution failed because the return code was nonzero
29 Runtime error 28 ms 1432 KB Execution failed because the return code was nonzero
30 Runtime error 14 ms 1432 KB Execution failed because the return code was nonzero
31 Runtime error 2 ms 1432 KB Execution failed because the return code was nonzero
32 Runtime error 2 ms 1432 KB Execution failed because the return code was nonzero
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 1432 KB Output isn't correct
2 Runtime error 2 ms 1432 KB Execution failed because the return code was nonzero
3 Runtime error 2 ms 1432 KB Execution failed because the return code was nonzero
4 Runtime error 2 ms 1432 KB Execution failed because the return code was nonzero
5 Runtime error 2 ms 1432 KB Execution failed because the return code was nonzero
6 Runtime error 2 ms 1432 KB Execution failed because the return code was nonzero
7 Runtime error 2 ms 1432 KB Execution failed because the return code was nonzero
8 Runtime error 2 ms 1432 KB Execution failed because the return code was nonzero
9 Runtime error 2 ms 1432 KB Execution failed because the return code was nonzero
10 Runtime error 2 ms 1432 KB Execution failed because the return code was nonzero
11 Runtime error 2 ms 1432 KB Execution failed because the return code was nonzero
12 Runtime error 2 ms 1432 KB Execution failed because the return code was nonzero
13 Runtime error 2 ms 1432 KB Execution failed because the return code was nonzero
14 Runtime error 2 ms 1432 KB Execution failed because the return code was nonzero
15 Runtime error 2 ms 1432 KB Execution failed because the return code was nonzero
16 Runtime error 8 ms 1432 KB Execution failed because the return code was nonzero
17 Runtime error 8 ms 1432 KB Execution failed because the return code was nonzero
18 Runtime error 8 ms 1432 KB Execution failed because the return code was nonzero
19 Runtime error 8 ms 1432 KB Execution failed because the return code was nonzero
20 Runtime error 5 ms 1432 KB Execution failed because the return code was nonzero
21 Runtime error 28 ms 1432 KB Execution failed because the return code was nonzero
22 Runtime error 28 ms 1432 KB Execution failed because the return code was nonzero
23 Runtime error 28 ms 1512 KB Execution failed because the return code was nonzero
24 Runtime error 28 ms 1512 KB Execution failed because the return code was nonzero
25 Runtime error 20 ms 1512 KB Execution failed because the return code was nonzero
26 Runtime error 28 ms 1512 KB Execution failed because the return code was nonzero
27 Runtime error 28 ms 1512 KB Execution failed because the return code was nonzero
28 Runtime error 28 ms 1512 KB Execution failed because the return code was nonzero
29 Runtime error 28 ms 1512 KB Execution failed because the return code was nonzero
30 Runtime error 14 ms 1512 KB Execution failed because the return code was nonzero
31 Runtime error 2 ms 1512 KB Execution failed because the return code was nonzero
32 Runtime error 2 ms 1512 KB Execution failed because the return code was nonzero