제출 #1365540

#제출 시각아이디문제언어결과실행 시간메모리
1365540yonatanlGap (APIO16_gap)C++20
0 / 100
35 ms1216 KiB
#include "gap.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <bitset>
#include <math.h>
#include <iomanip>

#define rep(i, s, e) for (ll i = s; i < e; i++)
#define upmax(a, b) a = max(a, b)
#define upmin(a, b) a = min(a, b)

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;

const ll INF = 2e18;
const ll MOD = 1e9 + 7;

long long findGap(int T, int N) {
	ll n = N;
	ll first = -1, last = -1;
	MinMax(0, 1e18, &first, &last);
	ll L = (last - first);
	ll x = (L + n - 2) / (n - 1);
	ll last_finish = -1;
	ll ans = 0;
	for (ll i = first; i <= last - x + 1; i += x) {
		ll cur_first = -1, cur_last = -1;
		MinMax(i, i + x - 1, &cur_first, &cur_last);
		if (last_finish != -1) {
			upmax(ans, cur_first - last_finish);
			upmax(ans, cur_last - cur_first);
		}
		upmax(last_finish, cur_last);
	}
	return ans;
}

/*
4
2 3 6 8
*/
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…