# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
243126 | socho | Just Long Neckties (JOI20_ho_t1) | C++14 | 375 ms | 18808 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "bits/stdc++.h"
using namespace std;
void fast() {
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
}
void ran() {
srand(chrono::steady_clock::now().time_since_epoch().count());
}
long long get_rand() {
long long a = rand();
long long b = rand();
return a * (RAND_MAX + 1ll) + b;
}
// #define endl '\n'
// #define double long double
// #define int long long
// int MOD = 1000 * 1000 * 1000 + 7;
// int MOD = 998244353;
signed main() {
ran(); fast();
int n;
cin >> n;
pair<int, int> ops[n+1];
for (int i=0; i<n+1; i++) {
cin >> ops[i].first;
ops[i].second = i;
}
int arr[n];
for (int i=0; i<n; i++) {
cin >> arr[i];
}
sort(arr, arr+n);
sort(ops, ops+n+1);
multiset<int> dfs;
for (int i=1; i<n+1; i++) {
dfs.insert(max(ops[i].first - arr[i-1], 0));
}
int ans[n+1];
// cout << ops[0].second << endl;
ans[ops[0].second] = *(--dfs.end());
for (int i=1; i<n+1; i++) {
dfs.erase(dfs.find(max(ops[i].first - arr[i-1], 0)));
dfs.insert(max(ops[i-1].first - arr[i-1], 0));
ans[ops[i].second] = *(--dfs.end());
// cout << ops[i].second << endl;
}
for (int i=0; i<n+1; i++) {
cout << ans[i] << ' ';
}
cout << endl;
}
컴파일 시 표준 에러 (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... |