Submission #668327

# Submission time Handle Problem Language Result Execution time Memory
668327 2022-12-03T16:16:27 Z birthdaycake Gap (APIO16_gap) C++17
0 / 100
58 ms 2264 KB
#include "gap.h"
#include<bits/stdc++.h>
using namespace std;


long long findGap(int T, int N){
    long long l = 0, r = 0, mn = 0, mx = 0;
    MinMax(1, 1000000000000000000, &mn, &mx);
    l = mn; r = mx;
    long long sz = (r - l + 1) / (N - 1), j = 0;
    vector<pair<int,int>>d;
    for(j = l; j <= r; j += sz+1){
        MinMax(j, j + sz, &mn, &mx);
        d.push_back({mn, mx});
    }
    MinMax(j, r, &mn, &mx);
    d.push_back({mn, mx});
    long long ans = sz;
    mx = d[0].second;
    for(int i = 1; i < d.size(); i++){
        if(d[i].first != -1){
            ans = max(ans, d[i].first - mx);
            mx = d[i].second;
        }
        
    }
    return ans;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:20:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     for(int i = 1; i < d.size(); i++){
      |                    ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
2 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
3 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
4 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
5 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
6 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
7 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
8 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
9 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
10 Runtime error 1 ms 208 KB Execution failed because the return code was nonzero
11 Runtime error 1 ms 336 KB Execution failed because the return code was nonzero
12 Runtime error 1 ms 336 KB Execution failed because the return code was nonzero
13 Runtime error 1 ms 336 KB Execution failed because the return code was nonzero
14 Runtime error 1 ms 336 KB Execution failed because the return code was nonzero
15 Runtime error 1 ms 336 KB Execution failed because the return code was nonzero
16 Runtime error 11 ms 812 KB Execution failed because the return code was nonzero
17 Runtime error 12 ms 848 KB Execution failed because the return code was nonzero
18 Runtime error 13 ms 848 KB Execution failed because the return code was nonzero
19 Runtime error 12 ms 848 KB Execution failed because the return code was nonzero
20 Runtime error 6 ms 848 KB Execution failed because the return code was nonzero
21 Runtime error 58 ms 2244 KB Execution failed because the return code was nonzero
22 Runtime error 54 ms 2244 KB Execution failed because the return code was nonzero
23 Runtime error 49 ms 2216 KB Execution failed because the return code was nonzero
24 Runtime error 49 ms 2200 KB Execution failed because the return code was nonzero
25 Runtime error 44 ms 2236 KB Execution failed because the return code was nonzero
26 Runtime error 51 ms 2184 KB Execution failed because the return code was nonzero
27 Runtime error 50 ms 2208 KB Execution failed because the return code was nonzero
28 Runtime error 50 ms 2212 KB Execution failed because the return code was nonzero
29 Runtime error 49 ms 2132 KB Execution failed because the return code was nonzero
30 Runtime error 30 ms 2244 KB Execution failed because the return code was nonzero
31 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
32 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
2 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
3 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
4 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
5 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
6 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
7 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
8 Runtime error 1 ms 208 KB Execution failed because the return code was nonzero
9 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
10 Runtime error 1 ms 208 KB Execution failed because the return code was nonzero
11 Runtime error 1 ms 336 KB Execution failed because the return code was nonzero
12 Runtime error 1 ms 336 KB Execution failed because the return code was nonzero
13 Runtime error 1 ms 336 KB Execution failed because the return code was nonzero
14 Runtime error 1 ms 336 KB Execution failed because the return code was nonzero
15 Runtime error 1 ms 336 KB Execution failed because the return code was nonzero
16 Runtime error 11 ms 808 KB Execution failed because the return code was nonzero
17 Runtime error 11 ms 896 KB Execution failed because the return code was nonzero
18 Runtime error 12 ms 848 KB Execution failed because the return code was nonzero
19 Runtime error 12 ms 912 KB Execution failed because the return code was nonzero
20 Runtime error 6 ms 840 KB Execution failed because the return code was nonzero
21 Runtime error 50 ms 2136 KB Execution failed because the return code was nonzero
22 Runtime error 51 ms 2240 KB Execution failed because the return code was nonzero
23 Runtime error 49 ms 2216 KB Execution failed because the return code was nonzero
24 Runtime error 54 ms 2204 KB Execution failed because the return code was nonzero
25 Runtime error 50 ms 2196 KB Execution failed because the return code was nonzero
26 Runtime error 48 ms 2264 KB Execution failed because the return code was nonzero
27 Runtime error 49 ms 2172 KB Execution failed because the return code was nonzero
28 Runtime error 48 ms 2204 KB Execution failed because the return code was nonzero
29 Runtime error 52 ms 2176 KB Execution failed because the return code was nonzero
30 Runtime error 28 ms 2256 KB Execution failed because the return code was nonzero
31 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero
32 Runtime error 0 ms 208 KB Execution failed because the return code was nonzero