Submission #258323

#TimeUsernameProblemLanguageResultExecution timeMemory
258323shashwatchandraGap (APIO16_gap)C++17
30 / 100
67 ms2332 KiB
/*input

*/
#include<bits/stdc++.h>
#include <stdio.h>
#include <stdlib.h>
#include "gap.h"
using namespace std;

#define int long long 
#define double long double
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()

#define RE(i,n) for (int i = 1; i <= n; i++)
#define RED(i,n) for (int i = n; i > 0; i--)
#define REPS(i,n) for(int i = 1; (i*i) <= n; i++)
#define REP(i,n) for (int i = 0; i < (int)n; i++)

#undef int
long long findGap(int T, int N)
{
#define int long long
	if(T == 1){
		vector<int> all;
		int curl = 1;
		int curr = 1e18;
		int dd = 0;
		while(curl <= curr and dd < N){
			int whAt1 = 0;
			int whAt2 = 0;
			MinMax(curl,curr,&whAt1,&whAt2);
			all.pb(whAt1);
			if(whAt1 != whAt2)all.pb(whAt2);
			dd += 1+(whAt1 != whAt2);
			curl = whAt1+1;
			curr = whAt2-1;
		}
		sort(all(all));
		int ans = 0;
		REP(i,N-1){
			ans = max(ans,all[i+1]-all[i]);
		}
		return ans;
	}
	return 0;
}

#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...