QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#222921 | #7617. Spectacle | ucup-team1264# | TL | 0ms | 3448kb | C++20 | 1.0kb | 2023-10-21 19:42:48 | 2023-10-21 19:42:48 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
constexpr i64 INF = 1e18 + 1145;
void solve() {
int n;
cin >> n;
vector<i64> a(n);
for (int i = 0; i < n; i++)
cin >> a[i];
ranges::sort(a);
vector<i64> ans(n + 1);
function<void(int, int, i64, i64)> solve = [&](int l, int r, i64 vl,
i64 vr) {
if (vl == vr) {
for (int i = l; i <= r; i++)
ans[i] = vl;
return;
}
if (l > r) return;
int c = 0;
i64 vm = (vl + vr) / 2;
for (int i = 0; i < n - 1; i++) {
if (a[i + 1] - a[i] <= vm) c++, i++;
}
solve(l, c, vl, vm), solve(c + 1, r, vm + 1, vr);
};
solve(1, n / 2, 0, INF);
for (int i = 1; i <= n / 2; i++)
cout << ans[i] << " ";
cout << "\n";
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
// cin >> t;
while (t--) {
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3448kb
input:
6 100 13 20 14 10 105
output:
1 5 6
result:
ok single line: '1 5 6 '
Test #2:
score: 0
Accepted
time: 0ms
memory: 3416kb
input:
2 1 1000000000000000000
output:
999999999999999999
result:
ok single line: '999999999999999999 '
Test #3:
score: -100
Time Limit Exceeded
input:
200000 30977570544127554 30977570529630987 30977570554040634 30977570903666181 30977570284338326 30977570675313216 30977569987827221 30977570780807305 30977570623822067 30977570207823010 30977569932624714 30977570440962037 30977570343703869 30977570239637322 30977570141845422 30977570372368100 30977...