제출 #238087

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
2380872020-06-09 22:09:00DS007Gap (APIO16_gap)C++14
30 / 100
87 ms5880 KiB
#include <bits/stdc++.h>
using namespace std;
#include "gap.h"
long long solve1(int n) {
set<long long> s;
long long l = 0, h = 1e18;
while (s.size() != n) {
long long mn = -1, mx = -1;
MinMax(l, h, &mn, &mx);
l = mn + 1, h = mx - 1;
s.insert(mn);
s.insert(mx);
}
long long last = 1e18, ans = 0;
for (auto i : s) {
ans = max(ans, i - last);
last = i;
}
return ans;
}
long long solve2(int n) {
long long mn = -1, mx = -1, l = 0, h = 1e18, tm1 = -1, tm2 = -1;
MinMax(l, h, &mn, &mx);
if (n == 2)
return mx - mn;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

컴파일 시 표준 에러 (stderr) 메시지

gap.cpp: In function 'long long int solve1(int)':
gap.cpp:8:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while (s.size() != n) {
            ~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...