Submission #256836

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
2568362020-08-03 09:27:15AM1648Gap (APIO16_gap)C++17
100 / 100
61 ms1916 KiB
/* be name khoda */
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
#define forifrom(i, s, n) for (ll i = s; i < n; ++i)
#define fori(i, n) forifrom(i, 0, n)
#define F first
#define S second
// ------------------------------------------------------------------
const ll maxn = 100010;
const ll maxa = 1000000000000000000;
ll A[maxn];
long long findGap(int T, int N) {
if (T == 1) {
A[0] = -1;
A[N + 1] = maxa + 1;
for (ll i = 0, j = N + 1; j - i > 1; ++i, --j) {
MinMax(A[i] + 1, A[j] - 1, A + i + 1, A + j - 1);
}
ll ans = 0;
forifrom (i, 1, N) ans = max(ans, A[i + 1] - A[i]);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...