Submission #142738

# Submission time Handle Problem Language Result Execution time Memory
142738 2019-08-10T15:56:54 Z HellAngel Gap (APIO16_gap) C++14
100 / 100
94 ms 3472 KB
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;


long long findGap(int T, int N)
{
    long long ans = 0;
    vector<long long> vt = {};
    long long Max, Min;
    MinMax(0, 1e18, &Min, &Max);
    if(T == 1)
    {
        vt.push_back(Max);
        vt.push_back(Min);
        long long l = 2;
        long long r = N - 1;
        while(l <= r)
        {
            long long a, b;
            MinMax(Min + 1, Max - 1, &Min, &Max);
            vt.push_back(Min);
            vt.push_back(Max);
            l++;
            r--;
        }
    }
    else
    {
        long long qr = (Max - Min + N - 2) / (N - 1);
        ans = qr;
        for(long long x = Min; x <= Max ; x += qr + 1)
        {
            long long xa,xb;
            MinMax(x, x + qr, &xa, &xb);
            vt.push_back(xa),vt.push_back(xb);
        }
    }
    sort(vt.begin(), vt.end());
    for(int i = 1; i < vt.size(); i++) ans = max(ans, vt[i] - vt[i - 1]);
	return ans;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:20:23: warning: unused variable 'a' [-Wunused-variable]
             long long a, b;
                       ^
gap.cpp:20:26: warning: unused variable 'b' [-Wunused-variable]
             long long a, b;
                          ^
gap.cpp:40:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 1; i < vt.size(); i++) ans = max(ans, vt[i] - vt[i - 1]);
                    ~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 3 ms 348 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 3 ms 376 KB Output is correct
16 Correct 16 ms 888 KB Output is correct
17 Correct 16 ms 888 KB Output is correct
18 Correct 16 ms 888 KB Output is correct
19 Correct 16 ms 916 KB Output is correct
20 Correct 13 ms 888 KB Output is correct
21 Correct 61 ms 2288 KB Output is correct
22 Correct 60 ms 2260 KB Output is correct
23 Correct 60 ms 2284 KB Output is correct
24 Correct 60 ms 2284 KB Output is correct
25 Correct 52 ms 2288 KB Output is correct
26 Correct 60 ms 2288 KB Output is correct
27 Correct 61 ms 2288 KB Output is correct
28 Correct 61 ms 2260 KB Output is correct
29 Correct 61 ms 2284 KB Output is correct
30 Correct 45 ms 2288 KB Output is correct
31 Correct 2 ms 376 KB Output is correct
32 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
14 Correct 4 ms 424 KB Output is correct
15 Correct 3 ms 376 KB Output is correct
16 Correct 24 ms 1140 KB Output is correct
17 Correct 22 ms 1136 KB Output is correct
18 Correct 22 ms 1204 KB Output is correct
19 Correct 21 ms 1140 KB Output is correct
20 Correct 12 ms 1140 KB Output is correct
21 Correct 94 ms 3252 KB Output is correct
22 Correct 82 ms 3280 KB Output is correct
23 Correct 87 ms 3472 KB Output is correct
24 Correct 84 ms 3308 KB Output is correct
25 Correct 75 ms 3308 KB Output is correct
26 Correct 83 ms 3308 KB Output is correct
27 Correct 83 ms 3308 KB Output is correct
28 Correct 85 ms 3268 KB Output is correct
29 Correct 83 ms 3308 KB Output is correct
30 Correct 44 ms 3308 KB Output is correct
31 Correct 2 ms 376 KB Output is correct
32 Correct 2 ms 376 KB Output is correct