Submission #875370

#TimeUsernameProblemLanguageResultExecution timeMemory
875370ZeroCoolGap (APIO16_gap)C++14
0 / 100
22 ms3020 KiB
#include <bits/stdc++.h>
#include "gap.h"

using namespace std;

//#define int long long

#define pb push_back
#define mp make_pair
#define mt make_tuple
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

using ll = long long;
using ld = long double;

const int N = 1e5 + 5;
const int M = 405;
const int SQRT = 500;
const int LOG = 20;
const int INF = 1e18;
const int MOD = 1e9+7;
const ld EPS = 1e-9;

ll findGap(int t, int n){
	ll mn ,mx;
	MinMax(0, INF, &mn, &mx);
	if(t == 1){
		if(n == 2)return mx - mn;

		ll l = mn;
		ll r = mx;
		ll ans = -INF;
		for(int i = 0;i<(n - 1) / 2;i++){
			MinMax(l+1, r-1, &mn, &mx);
			ans = max(ans, mn - l);
			ans = max(ans, r - mx);
			l = mn;
			r = mx;
		}

		return ans;
	}
}

Compilation message (stderr)

gap.cpp:21:17: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   21 | const int INF = 1e18;
      |                 ^~~~
gap.cpp: In function 'll findGap(int, int)':
gap.cpp:44:1: warning: control reaches end of non-void function [-Wreturn-type]
   44 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...