Submission #112063

# Submission time Handle Problem Language Result Execution time Memory
112063 2019-05-17T08:13:13 Z Eug1ena Gap (APIO16_gap) C++14
0 / 100
82 ms 5052 KB
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint INF = 1e18;

lint findGap(int T, int N){
    if(T == 1){
        vector<lint> left{-INF}, right{INF + 100};
        while(left.back() + 2 <= right.back()){
            lint l, r;
            MinMax(left.back() + 1, right.back() - 1, &l, &r);
            if(l == -1){
                break;
            }
            left.push_back(l);
            right.push_back(r);
        }
        vector<lint> a;
        for(int i = 1; i < left.size(); i++){
            a.push_back(left[i]);
        }
        for(int i = int(right.size()) - 1; i >= 1; i--){
            a.push_back(right[i]);
        }
        lint ans = 0;
        for(int i = 1; i < a.size(); i++){
            ans = max(ans, a[i] - a[i - 1]);
        }
        return ans;
    }else{
        return -1;
    }
}

Compilation message

gap.cpp: In function 'lint findGap(int, int)':
gap.cpp:20:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i = 1; i < left.size(); i++){
                        ~~^~~~~~~~~~~~~
gap.cpp:27:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i = 1; i < a.size(); i++){
                        ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 384 KB Output is correct
6 Incorrect 2 ms 384 KB Output isn't correct
7 Incorrect 2 ms 384 KB Output isn't correct
8 Incorrect 2 ms 384 KB Output isn't correct
9 Incorrect 2 ms 384 KB Output isn't correct
10 Correct 2 ms 384 KB Output is correct
11 Incorrect 3 ms 512 KB Output isn't correct
12 Incorrect 3 ms 384 KB Output isn't correct
13 Incorrect 3 ms 384 KB Output isn't correct
14 Incorrect 3 ms 384 KB Output isn't correct
15 Incorrect 3 ms 384 KB Output isn't correct
16 Incorrect 14 ms 1692 KB Output isn't correct
17 Incorrect 14 ms 1664 KB Output isn't correct
18 Incorrect 20 ms 1656 KB Output isn't correct
19 Incorrect 14 ms 1664 KB Output isn't correct
20 Correct 10 ms 1344 KB Output is correct
21 Incorrect 54 ms 4892 KB Output isn't correct
22 Incorrect 50 ms 4892 KB Output isn't correct
23 Incorrect 56 ms 4884 KB Output isn't correct
24 Incorrect 82 ms 5052 KB Output isn't correct
25 Incorrect 42 ms 4252 KB Output isn't correct
26 Incorrect 58 ms 4932 KB Output isn't correct
27 Incorrect 47 ms 4892 KB Output isn't correct
28 Incorrect 47 ms 4892 KB Output isn't correct
29 Incorrect 47 ms 4892 KB Output isn't correct
30 Correct 38 ms 3740 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Incorrect 2 ms 384 KB Output isn't correct
4 Incorrect 2 ms 384 KB Output isn't correct
5 Incorrect 2 ms 384 KB Output isn't correct
6 Incorrect 2 ms 384 KB Output isn't correct
7 Incorrect 2 ms 384 KB Output isn't correct
8 Incorrect 2 ms 384 KB Output isn't correct
9 Incorrect 2 ms 384 KB Output isn't correct
10 Incorrect 2 ms 384 KB Output isn't correct
11 Incorrect 2 ms 384 KB Output isn't correct
12 Incorrect 3 ms 384 KB Output isn't correct
13 Incorrect 2 ms 384 KB Output isn't correct
14 Incorrect 2 ms 384 KB Output isn't correct
15 Incorrect 2 ms 384 KB Output isn't correct
16 Incorrect 8 ms 1024 KB Output isn't correct
17 Incorrect 8 ms 1024 KB Output isn't correct
18 Incorrect 9 ms 996 KB Output isn't correct
19 Incorrect 8 ms 1024 KB Output isn't correct
20 Incorrect 10 ms 640 KB Output isn't correct
21 Incorrect 28 ms 2944 KB Output isn't correct
22 Incorrect 29 ms 2964 KB Output isn't correct
23 Incorrect 24 ms 2944 KB Output isn't correct
24 Incorrect 24 ms 2936 KB Output isn't correct
25 Incorrect 18 ms 2296 KB Output isn't correct
26 Incorrect 25 ms 2936 KB Output isn't correct
27 Incorrect 27 ms 2936 KB Output isn't correct
28 Incorrect 25 ms 2936 KB Output isn't correct
29 Incorrect 24 ms 2936 KB Output isn't correct
30 Incorrect 13 ms 1792 KB Output isn't correct
31 Incorrect 2 ms 428 KB Output isn't correct
32 Incorrect 2 ms 384 KB Output isn't correct