제출 #1366280

#제출 시각아이디문제언어결과실행 시간메모리
1366280vahagngGap (APIO16_gap)C++20
0 / 100
35 ms7072 KiB
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;

long long findGap(int T, int N){
	long long mn = 0, mx = 1e18;
	set<long long> st;
	long long pre = 0, prepre = 1e18;
	for(int i = 0; i < N / 2; i++){
		MinMax(pre + 1, prepre - 1, &mn, &mx);
		st.insert(mn);
		st.insert(mx);
		// cerr << mn << ' ' << mx << endl;
		pre = mn;
		prepre = mx;
	}
	if(N & 1){
		MinMax(pre + 1, prepre - 1, &mn, &mx);
		st.insert(mn);
	}
	vector<long long> a;
	for(auto i : st) a.push_back(i);
	// for(auto i : a) cerr << i << ' ';
	cerr << endl;
	long long res = 0;
	for(int i = 1; i < N; i++){
		if(res < a[i] - a[i - 1]){
			res = a[i] - a[i - 1];
		}
	}
	return res;
}
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…