Submission #1130590

#TimeUsernameProblemLanguageResultExecution timeMemory
1130590lopkusJust Long Neckties (JOI20_ho_t1)C++20
0 / 100
1 ms320 KiB
#include <bits/stdc++.h> #define int long long using namespace std; signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; vector<int> a(n + 2); vector<int> b(n + 1); for(int i = 1; i <= n + 1; i++) { cin >> a[i]; } for(int i = 1; i <= n; i++) { cin >> b[i]; } sort(b.begin() + 1, b.end()); for(int i = 1; i <= n + 1; i++) { set<int> s; for(int j = 1; j <= n + 1; j++) { if(j ^ i) { s.insert(a[j]); } } int ans = 0; for(int j = 1; j <= n; j++) { auto it = s.lower_bound(b[j]); ans = max(ans, *it - b[j]); s.erase(it); } cout << ans << " "; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...