Submission #566920

#TimeUsernameProblemLanguageResultExecution timeMemory
566920birthdaycakeJust Long Neckties (JOI20_ho_t1)C++17
9 / 100
1075 ms7228 KiB
#include<bits/stdc++.h> #define endl '\n' #define int long long #define mod 1000000007 #define boost ios_base::sync_with_stdio(false), cin.tie(NULL); using namespace std; int a[200001],b[200001],s[200001]; signed main(){ boost; int n; cin >> n; for(int i = 0; i < n + 1; i++) cin >> a[i]; for(int i = 0; i < n; i++) cin >> b[i]; sort(b,b+n); for(int i = 0; i < n + 1; i++){ vector<int>x; for(int j = 0; j < n + 1; j++){ if(i != j) x.push_back(a[j]); } sort(x.begin(), x.end()); int ans = 0; for(int j = 0; j < n; j++){ ans = max(ans,x[j] - b[j]); } s[i] = ans; } for(int i = 0; i < n + 1; i++) cout << s[i] << ' '; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...