Submission #715385

# Submission time Handle Problem Language Result Execution time Memory
715385 2023-03-26T15:19:13 Z study Gap (APIO16_gap) C++17
0 / 100
51 ms 4392 KB
#include <bits/stdc++.h>
#include "gap.h"
using ll = long long;
using namespace std;

long long findGap(int T, int N){
	ll pmini = -1, pmaxi = 1e18+1;
	vector<ll> ans;
	bool ok1 = 0, ok2 = 0;
	for (int i=0; i<(N+1)/2; ++i){
		long long a,b;
		MinMax(pmini+1,pmaxi-1,&a,&b);
		if (a != -1 and !ok1) ans.emplace_back(a);
		if (b != -1 and a != b and !ok2) ans.emplace_back(b);
		if (a != -1) pmini = a;
		else ok1 = 1;
		if (b != -1) pmaxi = b;
		else ok2 = 1;
		if (a >= b) break;
	}
	sort(ans.begin(),ans.end());
	ans.erase(unique(ans.begin(),ans.end()));
	ll res = 0;
	for (int i=1; i<ans.size(); ++i){
		res = max(res,ans[i]-ans[i-1]);
	}
	return res;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:24:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |  for (int i=1; i<ans.size(); ++i){
      |                ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 464 KB Execution killed with signal 11
2 Runtime error 1 ms 456 KB Execution killed with signal 11
3 Runtime error 1 ms 464 KB Execution killed with signal 11
4 Runtime error 1 ms 464 KB Execution killed with signal 11
5 Runtime error 1 ms 464 KB Execution killed with signal 11
6 Runtime error 1 ms 464 KB Execution killed with signal 11
7 Runtime error 2 ms 464 KB Execution killed with signal 11
8 Runtime error 1 ms 464 KB Execution killed with signal 11
9 Runtime error 1 ms 464 KB Execution killed with signal 11
10 Runtime error 1 ms 464 KB Execution killed with signal 11
11 Runtime error 1 ms 592 KB Execution killed with signal 11
12 Runtime error 1 ms 592 KB Execution killed with signal 11
13 Runtime error 2 ms 592 KB Execution killed with signal 11
14 Runtime error 1 ms 592 KB Execution killed with signal 11
15 Runtime error 1 ms 592 KB Execution killed with signal 11
16 Runtime error 10 ms 1592 KB Execution killed with signal 11
17 Runtime error 11 ms 1612 KB Execution killed with signal 11
18 Runtime error 12 ms 1608 KB Execution killed with signal 11
19 Runtime error 11 ms 1576 KB Execution killed with signal 11
20 Runtime error 11 ms 1600 KB Execution killed with signal 11
21 Runtime error 41 ms 4380 KB Execution killed with signal 11
22 Runtime error 41 ms 4360 KB Execution killed with signal 11
23 Runtime error 42 ms 4328 KB Execution killed with signal 11
24 Runtime error 43 ms 4284 KB Execution killed with signal 11
25 Runtime error 39 ms 4272 KB Execution killed with signal 11
26 Runtime error 47 ms 4356 KB Execution killed with signal 11
27 Runtime error 44 ms 4280 KB Execution killed with signal 11
28 Runtime error 43 ms 4356 KB Execution killed with signal 11
29 Runtime error 42 ms 4300 KB Execution killed with signal 11
30 Runtime error 41 ms 4320 KB Execution killed with signal 11
31 Runtime error 1 ms 464 KB Execution killed with signal 11
32 Runtime error 1 ms 464 KB Execution killed with signal 11
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 464 KB Execution killed with signal 11
2 Runtime error 1 ms 464 KB Execution killed with signal 11
3 Runtime error 1 ms 464 KB Execution killed with signal 11
4 Runtime error 1 ms 464 KB Execution killed with signal 11
5 Runtime error 1 ms 464 KB Execution killed with signal 11
6 Runtime error 1 ms 464 KB Execution killed with signal 11
7 Runtime error 1 ms 464 KB Execution killed with signal 11
8 Runtime error 1 ms 464 KB Execution killed with signal 11
9 Runtime error 1 ms 464 KB Execution killed with signal 11
10 Runtime error 1 ms 464 KB Execution killed with signal 11
11 Runtime error 2 ms 464 KB Execution killed with signal 11
12 Runtime error 2 ms 592 KB Execution killed with signal 11
13 Runtime error 2 ms 592 KB Execution killed with signal 11
14 Runtime error 2 ms 592 KB Execution killed with signal 11
15 Runtime error 1 ms 592 KB Execution killed with signal 11
16 Runtime error 11 ms 1576 KB Execution killed with signal 11
17 Runtime error 12 ms 1612 KB Execution killed with signal 11
18 Runtime error 11 ms 1612 KB Execution killed with signal 11
19 Runtime error 12 ms 1692 KB Execution killed with signal 11
20 Runtime error 12 ms 1612 KB Execution killed with signal 11
21 Runtime error 43 ms 4344 KB Execution killed with signal 11
22 Runtime error 49 ms 4280 KB Execution killed with signal 11
23 Runtime error 42 ms 4348 KB Execution killed with signal 11
24 Runtime error 45 ms 4376 KB Execution killed with signal 11
25 Runtime error 48 ms 4392 KB Execution killed with signal 11
26 Runtime error 51 ms 4340 KB Execution killed with signal 11
27 Runtime error 50 ms 4372 KB Execution killed with signal 11
28 Runtime error 46 ms 4296 KB Execution killed with signal 11
29 Runtime error 43 ms 4356 KB Execution killed with signal 11
30 Runtime error 39 ms 4320 KB Execution killed with signal 11
31 Runtime error 1 ms 464 KB Execution killed with signal 11
32 Runtime error 1 ms 464 KB Execution killed with signal 11