# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
314274 | BeanZ | Just Long Neckties (JOI20_ho_t1) | C++14 | 370 ms | 18936 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// I_Love_LPL
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
const int N = 2e5 + 5;
pair<ll, ll> a[N];
ll b[N], ans[N];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
if (fopen("A.inp", "r")){
freopen("test.inp", "r", stdin);
freopen("test.out", "w", stdout);
}
ll n;
cin >> n;
for (int i = 1; i <= (n + 1); i++) cin >> a[i].first, a[i].second = i;
sort(a + 1, a + n + 1 + 1);
for (int i = 1; i <= n; i++) cin >> b[i];
sort(b + 1, b + n + 1);
multiset<ll, greater<ll>> s;
for (int i = 2; i <= (n + 1); i++){
s.insert(max(a[i].first - b[i - 1], 0ll));
}
ans[a[1].second] = *s.begin();
for (int i = 2; i <= (n + 1); i++){
s.erase(s.find(max(a[i].first - b[i - 1], 0ll)));
s.insert(max(a[i - 1].first - b[i - 1], 0ll));
ans[a[i].second] = *s.begin();
}
for (int i = 1; i <= (n + 1); i++){
cout << ans[i] << " ";
}
}
/*
*/
컴파일 시 표준 에러 (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... |