Submission #909818

# Submission time Handle Problem Language Result Execution time Memory
909818 2024-01-17T12:53:10 Z oblantis Gap (APIO16_gap) C++17
70 / 100
38 ms 3112 KB
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#pragma GCC optimize("O3,unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include "gap.h"
#define all(v) v.begin(), v.end()
#define pb push_back
#define ss second
#define ff first
#define vt vector
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int, int> pii;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const ll inf = 1e18;
const int mod = 1e9+7;
const int maxn = 1e5 + 1;
//void MinMax(long long s, long long t, long long *mn, long long *mx)
//{
	//int lo = 1, hi = N, left = N+1, right = 0;
	//while (lo <= hi){
		//int mid = (lo+hi)>>1;
		//if (A[mid] >= s) hi = mid - 1, left = mid;
		//else lo = mid + 1;
	//}
	//lo = 1, hi = N;
	//while (lo <= hi){
		//int mid = (lo+hi)>>1;
		//if (A[mid] <= t) lo = mid + 1, right = mid;
		//else hi = mid - 1;
	//}
	//if (left > right) *mn = *mx = -1;
	//else{
		//*mn = A[left];
		//*mx = A[right];
	//}
//}
long long findGap(int t, int n){
	ll l, r;
	MinMax(0, inf, &l, &r);
	ll x = l + 1, bf = l;
	ll ret = (r - l + n - 2) / (n - 1);
	while(x < r){
		ll mn = -1, mx = -1;
		while(mn == -1){
			MinMax(x, x + ret, &mn, &mx);
			if(mn == -1)x = x + ret + 1;
		}
		ret = max(ret, mn - bf);
		bf = mx;
		x = bf + 1;
	}
	return ret;
}
//int main(){
	//cin >> N >> N;
	//for(int i = 1; i <= N; i++){
		//cin >> A[i];
	//}
	//cout << findGap(N, N);
	//return 0;
//}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Incorrect 1 ms 2392 KB Output isn't correct
3 Incorrect 1 ms 2392 KB Output isn't correct
4 Incorrect 1 ms 2392 KB Output isn't correct
5 Incorrect 1 ms 2392 KB Output isn't 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 Incorrect 1 ms 2392 KB Output isn't correct
11 Correct 1 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 2392 KB Output is correct
15 Incorrect 2 ms 2392 KB Output isn't correct
16 Correct 5 ms 2836 KB Output is correct
17 Correct 5 ms 2568 KB Output is correct
18 Correct 5 ms 2588 KB Output is correct
19 Correct 5 ms 2584 KB Output is correct
20 Correct 4 ms 2572 KB Output is correct
21 Correct 20 ms 2860 KB Output is correct
22 Correct 17 ms 3020 KB Output is correct
23 Correct 17 ms 2852 KB Output is correct
24 Correct 17 ms 3020 KB Output is correct
25 Incorrect 37 ms 3108 KB Output isn't correct
26 Correct 17 ms 2860 KB Output is correct
27 Correct 16 ms 2852 KB Output is correct
28 Correct 18 ms 2856 KB Output is correct
29 Correct 18 ms 2832 KB Output is correct
30 Correct 17 ms 2844 KB Output is correct
31 Correct 1 ms 2388 KB Output is correct
32 Incorrect 1 ms 2392 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 1 ms 2392 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 1 ms 2476 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 1 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 2392 KB Output is correct
15 Correct 1 ms 2644 KB Output is correct
16 Correct 5 ms 2584 KB Output is correct
17 Correct 5 ms 2836 KB Output is correct
18 Correct 5 ms 2584 KB Output is correct
19 Correct 5 ms 2648 KB Output is correct
20 Correct 4 ms 2572 KB Output is correct
21 Correct 17 ms 2844 KB Output is correct
22 Correct 17 ms 2852 KB Output is correct
23 Correct 17 ms 2856 KB Output is correct
24 Correct 17 ms 3108 KB Output is correct
25 Correct 38 ms 3020 KB Output is correct
26 Correct 17 ms 2852 KB Output is correct
27 Correct 18 ms 2812 KB Output is correct
28 Correct 17 ms 2856 KB Output is correct
29 Correct 19 ms 3112 KB Output is correct
30 Correct 13 ms 2848 KB Output is correct
31 Correct 1 ms 2392 KB Output is correct
32 Correct 1 ms 2392 KB Output is correct