Submission #541474

#TimeUsernameProblemLanguageResultExecution timeMemory
541474NyanCatTW1Just Long Neckties (JOI20_ho_t1)C++17
0 / 100
0 ms212 KiB
#include <iostream> #include <vector> #include <algorithm> #include <set> using namespace std; typedef long long LL; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int N; cin >> N; vector<LL> A(N + 1), B(N); for (int i = 0; i <= N; i++) { cin >> A[i]; } for (int i = 0; i < N; i++) { cin >> B[i]; } sort(A.begin(), A.end()); sort(B.begin(), B.end()); multiset<LL> vals; for (int i = 0; i < N; i++) { // After - Before; vals.insert(max(A[i + 1] - B[i], 0LL)); } for (int i = 0; i <= N; i++) { if (i) { vals.erase(vals.find(max(A[i] - B[i - 1], 0LL))); vals.insert(max(A[i - 1] - B[i - 1], 0LL)); } if (i) cout << ' '; cout << *vals.rbegin(); } cout << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...