# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
393591 | 2021-04-24T05:06:28 Z | 79brue | Just Long Neckties (JOI20_ho_t1) | C++14 | 316 ms | 18672 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n; pair<int, int> a[200002]; int b[200002]; multiset<int> mst; int ans[200002]; int main(){ scanf("%d", &n); for(int i=1; i<=n+1; i++){ scanf("%d", &a[i].first); a[i].second = i; } for(int i=1; i<=n; i++) scanf("%d", &b[i]); sort(a+1, a+n+2); sort(b+1, b+n+1); for(int i=1; i<=n; i++){ mst.insert(a[i].first - b[i]); } ans[a[n+1].second] = *mst.rbegin(); for(int i=n; i>=1; i--){ mst.erase(mst.find(a[i].first - b[i])); mst.insert(a[i+1].first - b[i]); ans[a[i].second] = *mst.rbegin(); } for(int i=1; i<=n+1; i++) printf("%d ", max(ans[i], 0)); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 312 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 1 ms | 204 KB | Output is correct |
11 | Correct | 1 ms | 204 KB | Output is correct |
12 | Correct | 1 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 312 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 1 ms | 204 KB | Output is correct |
11 | Correct | 1 ms | 204 KB | Output is correct |
12 | Correct | 1 ms | 204 KB | Output is correct |
13 | Correct | 1 ms | 332 KB | Output is correct |
14 | Correct | 1 ms | 328 KB | Output is correct |
15 | Correct | 2 ms | 332 KB | Output is correct |
16 | Correct | 1 ms | 332 KB | Output is correct |
17 | Correct | 2 ms | 460 KB | Output is correct |
18 | Correct | 2 ms | 332 KB | Output is correct |
19 | Correct | 2 ms | 464 KB | Output is correct |
20 | Correct | 2 ms | 420 KB | Output is correct |
21 | Correct | 2 ms | 460 KB | Output is correct |
22 | Correct | 2 ms | 460 KB | Output is correct |
23 | Correct | 2 ms | 408 KB | Output is correct |
24 | Correct | 2 ms | 456 KB | Output is correct |
25 | Correct | 2 ms | 368 KB | Output is correct |
26 | Correct | 4 ms | 356 KB | Output is correct |
27 | Correct | 2 ms | 460 KB | Output is correct |
28 | Correct | 2 ms | 460 KB | Output is correct |
29 | Correct | 2 ms | 332 KB | Output is correct |
30 | Correct | 3 ms | 460 KB | Output is correct |
31 | Correct | 2 ms | 460 KB | Output is correct |
32 | Correct | 2 ms | 460 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 312 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 1 ms | 204 KB | Output is correct |
10 | Correct | 1 ms | 204 KB | Output is correct |
11 | Correct | 1 ms | 204 KB | Output is correct |
12 | Correct | 1 ms | 204 KB | Output is correct |
13 | Correct | 1 ms | 332 KB | Output is correct |
14 | Correct | 1 ms | 328 KB | Output is correct |
15 | Correct | 2 ms | 332 KB | Output is correct |
16 | Correct | 1 ms | 332 KB | Output is correct |
17 | Correct | 2 ms | 460 KB | Output is correct |
18 | Correct | 2 ms | 332 KB | Output is correct |
19 | Correct | 2 ms | 464 KB | Output is correct |
20 | Correct | 2 ms | 420 KB | Output is correct |
21 | Correct | 2 ms | 460 KB | Output is correct |
22 | Correct | 2 ms | 460 KB | Output is correct |
23 | Correct | 2 ms | 408 KB | Output is correct |
24 | Correct | 2 ms | 456 KB | Output is correct |
25 | Correct | 2 ms | 368 KB | Output is correct |
26 | Correct | 4 ms | 356 KB | Output is correct |
27 | Correct | 2 ms | 460 KB | Output is correct |
28 | Correct | 2 ms | 460 KB | Output is correct |
29 | Correct | 2 ms | 332 KB | Output is correct |
30 | Correct | 3 ms | 460 KB | Output is correct |
31 | Correct | 2 ms | 460 KB | Output is correct |
32 | Correct | 2 ms | 460 KB | Output is correct |
33 | Correct | 236 ms | 17424 KB | Output is correct |
34 | Correct | 250 ms | 18116 KB | Output is correct |
35 | Correct | 264 ms | 17496 KB | Output is correct |
36 | Correct | 243 ms | 17988 KB | Output is correct |
37 | Correct | 245 ms | 18672 KB | Output is correct |
38 | Correct | 247 ms | 18356 KB | Output is correct |
39 | Correct | 285 ms | 17352 KB | Output is correct |
40 | Correct | 301 ms | 17184 KB | Output is correct |
41 | Correct | 278 ms | 17480 KB | Output is correct |
42 | Correct | 275 ms | 17468 KB | Output is correct |
43 | Correct | 288 ms | 17316 KB | Output is correct |
44 | Correct | 263 ms | 16716 KB | Output is correct |
45 | Correct | 274 ms | 16924 KB | Output is correct |
46 | Correct | 263 ms | 16776 KB | Output is correct |
47 | Correct | 197 ms | 17216 KB | Output is correct |
48 | Correct | 222 ms | 17220 KB | Output is correct |
49 | Correct | 306 ms | 17936 KB | Output is correct |
50 | Correct | 280 ms | 17820 KB | Output is correct |
51 | Correct | 316 ms | 17820 KB | Output is correct |
52 | Correct | 275 ms | 17860 KB | Output is correct |
53 | Correct | 303 ms | 17816 KB | Output is correct |