Submission #1027578

# Submission time Handle Problem Language Result Execution time Memory
1027578 2024-07-19T07:43:56 Z Gangsta Gap (APIO16_gap) C++14
0 / 100
20 ms 2856 KB
#include "bits/stdc++.h"
#include "gap.h"
#define ll long long
#define pb push_back
#define pii pair<ll,ll>
#define ff first
#define ss second
#define sz size()

const int N = 2e5 + 1;

using namespace std;

ll ans;

// void MinMax(ll s, ll t, ll &mn, ll &mx){
// 	int a, b;
// 	cin >> a >> b;
// 	mn = a;
// 	mx = b;
// }

ll findGap(int t, int n){
	ll mn = 1, mx = 1e18, tmp, tmp1;
	if(t == 1){
		while(1){
			tmp = mn, tmp1 = mx;
			MinMax(mn, mx, &mn+1, &mx-1);
			// cout << mn << ' ' << mx << '\n';
			if(mn == -1) return ans;
			ans = max({ans,mn-tmp, tmp1-mx});
		}
	}
}

// int main(){
//     int n, t;
//     cin >> t >> n;
//     cout << findGap(t, n);
// }

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:34:1: warning: control reaches end of non-void function [-Wreturn-type]
   34 | }
      | ^
gap.cpp:28:10: warning: array subscript -1 is outside array bounds of 'long long int [1]' [-Warray-bounds]
   28 |    MinMax(mn, mx, &mn+1, &mx-1);
      |    ~~~~~~^~~~~~~~~~~~~~~~~~~~~~
gap.cpp:24:13: note: while referencing 'mx'
   24 |  ll mn = 1, mx = 1e18, tmp, tmp1;
      |             ^~
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 344 KB Execution failed because the return code was nonzero
2 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
3 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
4 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
5 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
6 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
7 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
8 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
9 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
10 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
11 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
12 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
13 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
14 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
15 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
16 Runtime error 3 ms 2520 KB Execution failed because the return code was nonzero
17 Runtime error 4 ms 2392 KB Execution failed because the return code was nonzero
18 Runtime error 5 ms 2460 KB Execution failed because the return code was nonzero
19 Runtime error 4 ms 2392 KB Execution failed because the return code was nonzero
20 Runtime error 2 ms 2392 KB Execution failed because the return code was nonzero
21 Runtime error 13 ms 2800 KB Execution failed because the return code was nonzero
22 Runtime error 12 ms 2648 KB Execution failed because the return code was nonzero
23 Runtime error 18 ms 2856 KB Execution failed because the return code was nonzero
24 Runtime error 12 ms 2648 KB Execution failed because the return code was nonzero
25 Runtime error 10 ms 2848 KB Execution failed because the return code was nonzero
26 Runtime error 17 ms 2732 KB Execution failed because the return code was nonzero
27 Runtime error 12 ms 2648 KB Execution failed because the return code was nonzero
28 Runtime error 12 ms 2648 KB Execution failed because the return code was nonzero
29 Runtime error 12 ms 2736 KB Execution failed because the return code was nonzero
30 Runtime error 7 ms 2648 KB Execution failed because the return code was nonzero
31 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
32 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
2 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
3 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
4 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
5 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
6 Runtime error 1 ms 2388 KB Execution failed because the return code was nonzero
7 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
8 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
9 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
10 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
11 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
12 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
13 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
14 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
15 Runtime error 1 ms 2392 KB Execution failed because the return code was nonzero
16 Runtime error 3 ms 2392 KB Execution failed because the return code was nonzero
17 Runtime error 3 ms 2392 KB Execution failed because the return code was nonzero
18 Runtime error 4 ms 2392 KB Execution failed because the return code was nonzero
19 Runtime error 3 ms 2392 KB Execution failed because the return code was nonzero
20 Runtime error 2 ms 2392 KB Execution failed because the return code was nonzero
21 Runtime error 13 ms 2684 KB Execution failed because the return code was nonzero
22 Runtime error 12 ms 2648 KB Execution failed because the return code was nonzero
23 Runtime error 12 ms 2812 KB Execution failed because the return code was nonzero
24 Runtime error 12 ms 2648 KB Execution failed because the return code was nonzero
25 Runtime error 9 ms 2736 KB Execution failed because the return code was nonzero
26 Runtime error 12 ms 2832 KB Execution failed because the return code was nonzero
27 Runtime error 20 ms 2824 KB Execution failed because the return code was nonzero
28 Runtime error 15 ms 2648 KB Execution failed because the return code was nonzero
29 Runtime error 20 ms 2636 KB Execution failed because the return code was nonzero
30 Runtime error 7 ms 2648 KB Execution failed because the return code was nonzero
31 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero
32 Runtime error 0 ms 2392 KB Execution failed because the return code was nonzero