| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 201033 | HellAngel | Just Long Neckties (JOI20_ho_t1) | C++14 | 193 ms | 7544 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int maxn = 200007;
int n, b[maxn], IT[4 * maxn], ans[maxn];
pair<int, int> a[maxn];
void Update(int id, int l, int r, int pos, int val)
{
if(l == r)
{
IT[id] = val;
return;
}
int mid = l + r >> 1;
if(pos <= mid) Update(id * 2, l, mid, pos, val);
else Update(id * 2 + 1, mid + 1, r, pos, val);
IT[id] = max(IT[id * 2], IT[id * 2 + 1]);
}
int32_t main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
if(fopen("test.inp", "r")) freopen("test.inp", "r", stdin);
cin >> n;
for(int i = 1; i <= n + 1; i++)
{
cin >> a[i].first;
a[i].second = i;
}
sort(a + 1, a + n + 2);
for(int i = 1; i <= n; i++)
{
cin >> b[i];
}
sort(b + 1, b + n + 1);
for(int i = 1; i <= n; i++) Update(1, 1, n, i, a[i + 1].first - b[i]);
ans[a[1].second] = IT[1];
for(int i = 2; i <= n + 1; i++)
{
Update(1, 1, n, i - 1, a[i - 1].first - b[i - 1]);
ans[a[i].second] = IT[1];
}
for(int i = 1; i <= n + 1; i++)
{
cout << max(ans[i], 0) << ' ';
}
}컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
