이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gap.h"
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define llinf 8987654321987654321
#define inf 1987654321
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
vector<LL> vc;
unordered_set<LL> s;
LL subt1(int n)
{
LL fr=0, re=1000000000000000000, st, fin;
while(fr<=re){
MinMax(fr, re, &st, &fin);
if(!s.count(st)){
vc.pb(st);
s.insert(st);
}
if(!s.count(fin)){
vc.pb(fin);
s.insert(fin);
}
fr=st+1;
re=fin-1;
}
sort(vc.begin(), vc.end());
LL ans=0;
for(int i=0; i<n-1; i++){
ans=max(ans, vc[i+1]-vc[i]);
}
return ans;
}
LL subt2(int n)
{
return 0;
}
LL findGap(int T, int N)
{
if(T==1)return subt1(N);
return subt2(N);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |