# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1023732 | vjudge1 | Just Long Neckties (JOI20_ho_t1) | C++17 | 1043 ms | 8576 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define f first
#define s second
#pragma GCC optimize("O3")
#pragma GCC target("avx2")
using namespace std;
const int mod = 998244353;
void solve() {
int n, s;
cin >> n;
vector <int> v(n + 1), a(n);
for (int i = 0; i <= n; i++) {
cin >> v[i];
}
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(a.begin(), a.end());
vector <int> ans;
for (int i = 0 ; i <= n; i++) {
int mx = 0;
vector <int> idivjopu(n);
int k = 0;
for (int j = 0; j < n + 1; j++) {
if (j == i) continue;
idivjopu[k] = v[j];
k++;
}
sort(idivjopu.begin(), idivjopu.end());
for (int j = 0; j < n; j++) {
mx = max(idivjopu[j] - a[j], mx);
}
ans.pb(mx);
}
for (int i = 0; i <= n; i++) {
cout << ans[i] << " ";
}
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
//cin >> t;
while (t--) {
solve();
}
}
Compilation message (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... |