Submission #981636

# Submission time Handle Problem Language Result Execution time Memory
981636 2024-05-13T11:57:58 Z ShauryaTheShep Gap (APIO16_gap) C++14
30 / 100
42 ms 3876 KB
#include<bits/stdc++.h>
#include "gap.h"
using namespace std;
#define in pair<int, int>
#define int long long
#define f first
#define s second
#define pb push_back
#define pob pop_back
#define INF (int)2e18
#define MX (int)3e5+5
#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL)
 
 
int findgap1(int n)
{
	vector<int> a(n);
	int l = 0;
	int r = n-1;
	int cl = 0;
	int cr = 1e18;
	while(l <= r)
	{
		int x, y;
		MinMax(cl, cr, &x, &y);
		cl = x+1;
		cr = y-1;
		a[l++] = x;
		a[r--] = y;
	}
	int ok = 0;
	for(int i = 0; i < n-1; i++)
		ok = max(ok, a[i+1]-a[i]);
	return ok;
}
 
int findgap2(int n)
{
	int mn, mx;
	MinMax(0, 1e18, &mn, &mx);
	int d = (mx-mn)/n;
	//answer is >= d.
	int prev = mn; int ans = 0;
	for(int t = mn+1; t < mx; t+=d)
	{
		int x, y;
		MinMax(t, t+d-1, &x, &y);
		if(x != -1)
		{
			ans = max(ans, x-prev);
			prev = y;
		}
	}
	return ans;
}
 
//dummy real function
int findGap(signed T, signed n)
{
	int t = T;
	int N = n;
	if(t == 1)
		return findgap1(n);
	else
		return findgap2(n); 	 
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:61:6: warning: unused variable 'N' [-Wunused-variable]
   61 |  int N = n;
      |      ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 2392 KB Output is correct
3 Correct 0 ms 2392 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 1 ms 2644 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2392 KB Output is correct
8 Correct 1 ms 2392 KB Output is correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 1 ms 2392 KB Output is correct
11 Correct 2 ms 2392 KB Output is correct
12 Correct 1 ms 2392 KB Output is correct
13 Correct 1 ms 2392 KB Output is correct
14 Correct 1 ms 2400 KB Output is correct
15 Correct 1 ms 2392 KB Output is correct
16 Correct 8 ms 2580 KB Output is correct
17 Correct 8 ms 2752 KB Output is correct
18 Correct 9 ms 2708 KB Output is correct
19 Correct 8 ms 2592 KB Output is correct
20 Correct 7 ms 2576 KB Output is correct
21 Correct 30 ms 3504 KB Output is correct
22 Correct 34 ms 3552 KB Output is correct
23 Correct 30 ms 3628 KB Output is correct
24 Correct 30 ms 3624 KB Output is correct
25 Correct 27 ms 3572 KB Output is correct
26 Correct 30 ms 3628 KB Output is correct
27 Correct 30 ms 3628 KB Output is correct
28 Correct 30 ms 3620 KB Output is correct
29 Correct 30 ms 3876 KB Output is correct
30 Correct 25 ms 3620 KB Output is correct
31 Correct 1 ms 2392 KB Output is correct
32 Correct 1 ms 2488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2392 KB Output isn't correct
2 Partially correct 1 ms 2392 KB Partially correct
3 Partially correct 1 ms 2392 KB Partially correct
4 Partially correct 1 ms 2392 KB Partially correct
5 Partially correct 1 ms 2392 KB Partially correct
6 Partially correct 1 ms 2392 KB Partially correct
7 Partially correct 1 ms 2392 KB Partially correct
8 Partially correct 1 ms 2392 KB Partially correct
9 Partially correct 1 ms 2392 KB Partially correct
10 Partially correct 0 ms 2392 KB Partially correct
11 Partially correct 1 ms 2392 KB Partially correct
12 Partially correct 1 ms 2392 KB Partially correct
13 Partially correct 1 ms 2392 KB Partially correct
14 Partially correct 1 ms 2392 KB Partially correct
15 Partially correct 1 ms 2392 KB Partially correct
16 Partially correct 10 ms 2752 KB Partially correct
17 Partially correct 10 ms 2588 KB Partially correct
18 Partially correct 10 ms 2580 KB Partially correct
19 Partially correct 10 ms 2752 KB Partially correct
20 Partially correct 6 ms 2572 KB Partially correct
21 Partially correct 41 ms 2860 KB Partially correct
22 Partially correct 40 ms 2856 KB Partially correct
23 Partially correct 41 ms 2860 KB Partially correct
24 Partially correct 41 ms 3112 KB Partially correct
25 Partially correct 39 ms 2848 KB Partially correct
26 Partially correct 42 ms 3076 KB Partially correct
27 Partially correct 42 ms 2860 KB Partially correct
28 Partially correct 40 ms 2856 KB Partially correct
29 Partially correct 41 ms 2852 KB Partially correct
30 Partially correct 24 ms 2852 KB Partially correct
31 Partially correct 1 ms 2392 KB Partially correct
32 Partially correct 0 ms 2392 KB Partially correct