# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
233706 | 2020-05-21T13:05:53 Z | duality | Just Long Neckties (JOI20_ho_t1) | C++11 | 5 ms | 384 KB |
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back typedef long long int LLI; typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<pii> vpii; pii A[200001]; int B[200000],C[200001],ans[200001]; int main() { int i; int N; scanf("%d",&N); for (i = 0; i <= N; i++) scanf("%d",&A[i].first),A[i].second = i; for (i = 0; i < N; i++) scanf("%d",&B[i]); sort(A,A+N+1),sort(B,B+N); int m = 0; for (i = 0; i <= N; i++) { C[i] = max(C[i],m); if (i < N) m = max(m,abs(A[i].first-B[i])); } m = 0; for (i = N; i >= 0; i--) { C[i] = max(C[i],m); if (i < N) m = max(m,abs(A[i].first-B[i-1])); } for (i = 0; i <= N; i++) ans[A[i].second] = C[i]; for (i = 0; i <= N; i++) printf("%d ",ans[i]); printf("\n"); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Incorrect | 5 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Incorrect | 5 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Incorrect | 5 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |