# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
231784 | Haunted_Cpp | Just Long Neckties (JOI20_ho_t1) | C++17 | 297 ms | 15096 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize ("Ofast")
#pragma GCC target("fma,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("unroll-loops")
int main () {
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
vector<pair<int, int> > a (n + 1);
for (int i = 0; i <= n; i++) {
cin >> a[i].first;
a[i].second = i;
}
vector<int> pessoas (n);
for (int i = 0; i < n; i++) cin >> pessoas[i];
sort (a.begin(), a.end());
sort (pessoas.begin(), pessoas.end());
multiset<int> diff;
for (int i = 0; i < n; i++) diff.insert( max (a[i].first - pessoas[i], 0) );
vector<int> ans (n + 1, -1);
ans[a[n].second] = *diff.rbegin();
int last = a[n].first;
for (int i = n - 1; i >= 0; i--) {
int current = max (a[i].first - pessoas[i], 0);
diff.erase(diff.lower_bound(current));
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |