Submission #882299

# Submission time Handle Problem Language Result Execution time Memory
882299 2023-12-03T03:24:02 Z ono_de206 Gap (APIO16_gap) C++14
0 / 100
14 ms 3040 KB
#include "gap.h"
#include<bits/stdc++.h>
using namespace std;

#define in insert
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second

// #define int long long

typedef long long ll;
typedef vector<int> vi;
typedef set<int> si;
typedef multiset<int> msi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

long long findGap(int T, int N) {
	long long *qn, *qx;

	auto ask = [&](long long l, long long r) -> void {
		assert(l <= r);
		MinMax(l, r, qn, qx);
	};

	long long sus1 = 0, sus2 = (long long)1e18;

	ask(sus1, sus2);

	long long mn = *qn, mx = *qx, ans = 0;
	long long d = (mx - mn) / N;
	long long ls = mn, l = mn + 1;
	while(l <= mx) {
		long long r = l + d - 1;
		ask(l, r);
		if(*qn != -1) {
			ans = max(ans, *qn - ls);
			ls = *qx;
		}
		l = r + 1;
	}
	return ans;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:26:9: warning: 'qn' is used uninitialized in this function [-Wuninitialized]
   26 |   MinMax(l, r, qn, qx);
      |   ~~~~~~^~~~~~~~~~~~~~
gap.cpp:26:9: warning: 'qx' is used uninitialized in this function [-Wuninitialized]
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 344 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 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 1 ms 2392 KB Execution failed because the return code was nonzero
11 Runtime error 1 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 2492 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 2584 KB Execution failed because the return code was nonzero
17 Runtime error 3 ms 2596 KB Execution failed because the return code was nonzero
18 Runtime error 3 ms 2752 KB Execution failed because the return code was nonzero
19 Runtime error 3 ms 2584 KB Execution failed because the return code was nonzero
20 Runtime error 2 ms 2572 KB Execution failed because the return code was nonzero
21 Runtime error 12 ms 2864 KB Execution failed because the return code was nonzero
22 Runtime error 12 ms 2980 KB Execution failed because the return code was nonzero
23 Runtime error 12 ms 2852 KB Execution failed because the return code was nonzero
24 Runtime error 12 ms 2856 KB Execution failed because the return code was nonzero
25 Runtime error 9 ms 2848 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 14 ms 2860 KB Execution failed because the return code was nonzero
28 Runtime error 12 ms 2860 KB Execution failed because the return code was nonzero
29 Runtime error 12 ms 2856 KB Execution failed because the return code was nonzero
30 Runtime error 7 ms 2848 KB Execution failed because the return code was nonzero
31 Runtime error 1 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 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 1 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 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 1 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 4 ms 2752 KB Execution failed because the return code was nonzero
17 Runtime error 3 ms 2580 KB Execution failed because the return code was nonzero
18 Runtime error 3 ms 2752 KB Execution failed because the return code was nonzero
19 Runtime error 4 ms 2584 KB Execution failed because the return code was nonzero
20 Runtime error 2 ms 2572 KB Execution failed because the return code was nonzero
21 Runtime error 12 ms 2860 KB Execution failed because the return code was nonzero
22 Runtime error 12 ms 2860 KB Execution failed because the return code was nonzero
23 Runtime error 13 ms 2860 KB Execution failed because the return code was nonzero
24 Runtime error 12 ms 2860 KB Execution failed because the return code was nonzero
25 Runtime error 9 ms 2856 KB Execution failed because the return code was nonzero
26 Runtime error 12 ms 3040 KB Execution failed because the return code was nonzero
27 Runtime error 12 ms 2856 KB Execution failed because the return code was nonzero
28 Runtime error 12 ms 2780 KB Execution failed because the return code was nonzero
29 Runtime error 12 ms 3008 KB Execution failed because the return code was nonzero
30 Runtime error 7 ms 2848 KB Execution failed because the return code was nonzero
31 Runtime error 1 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