| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 68126 | shoemakerjo | Gap (APIO16_gap) | C++14 | 91 ms | 3568 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll findGap(int T, int N)
{
if (T == 1) {
vector<ll> nums;
ll lo = 1;
ll hi = 1000000000000000000LL;
int tseen = 0;
while (lo < hi) {
ll c1, c2;
MinMax(lo, hi, &c1, &c2);
nums.push_back(c1);
nums.push_back(c2);
tseen += 2;
if (tseen >= N) break;
lo = c1+1;
hi = c2-1;
}
ll ans = 0LL;
sort(nums.begin(), nums.end());
for (int i = 1; i < nums.size(); i++) {
ans = max(ans, nums[i]-nums[i-1]);
}
return ans;
}
//this is for T = 2
ll lo, hi;
MinMax(1, 1000000000000000000LL, &lo, &hi);
ll alph = (hi-lo)/N;
if ((hi-lo)%N != 0) alph+=1LL;
vector<ll> nums; //all the ones we care about
ll st = lo+1LL;
nums.push_back(lo);
while (st <= hi) {
ll c1, c2;
MinMax(st, st+alph, &c1, &c2);
if (c1 != -1) {
nums.push_back(c1);
nums.push_back(c2);
}
st += alph+1LL;
}
ll ans = alph;
for (int i = 1; i < nums.size(); i++) {
ans = max(ans, nums[i]-nums[i-1]);
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
