# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
224020 | 2020-04-17T04:49:33 Z | cheeheng | Just Long Neckties (JOI20_ho_t1) | C++14 | 315 ms | 14840 KB |
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> ii; ii C[200005]; int B[200005]; int ans[200005]; // 3 4 6 7 // 2 4 6 int main(){ int N; scanf("%d", &N); for(int i = 0; i <= N; i ++){ int x; scanf("%d", &x); C[i] = ii(x, i); } sort(C, C+(N+1)); for(int i = 0; i < N; i ++){ scanf("%d", &B[i]); } sort(B, B+N); multiset<int> oddities; for(int i = 0; i < N; i ++){ oddities.insert(max(C[i].first-B[i], 0)); } ans[C[N].second] = *(--oddities.end()); for(int i = N-1; i >= 0; i --){ oddities.erase(max(C[i].first-B[i], 0)); oddities.insert(max(C[i+1].first-B[i], 0)); ans[C[i].second] = *(--oddities.end()); } for(int i = 0; i <= N; i ++){ printf("%d ", ans[i]); } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
3 | Correct | 4 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 4 ms | 384 KB | Output is correct |
6 | Correct | 4 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 4 ms | 384 KB | Output is correct |
12 | Correct | 5 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
3 | Correct | 4 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 4 ms | 384 KB | Output is correct |
6 | Correct | 4 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 4 ms | 384 KB | Output is correct |
12 | Correct | 5 ms | 384 KB | Output is correct |
13 | Correct | 5 ms | 384 KB | Output is correct |
14 | Correct | 6 ms | 384 KB | Output is correct |
15 | Correct | 7 ms | 512 KB | Output is correct |
16 | Correct | 5 ms | 384 KB | Output is correct |
17 | Correct | 7 ms | 384 KB | Output is correct |
18 | Correct | 6 ms | 384 KB | Output is correct |
19 | Correct | 7 ms | 512 KB | Output is correct |
20 | Correct | 7 ms | 384 KB | Output is correct |
21 | Correct | 6 ms | 384 KB | Output is correct |
22 | Correct | 6 ms | 384 KB | Output is correct |
23 | Correct | 6 ms | 384 KB | Output is correct |
24 | Correct | 6 ms | 384 KB | Output is correct |
25 | Correct | 6 ms | 384 KB | Output is correct |
26 | Correct | 7 ms | 512 KB | Output is correct |
27 | Correct | 6 ms | 384 KB | Output is correct |
28 | Correct | 7 ms | 512 KB | Output is correct |
29 | Correct | 6 ms | 512 KB | Output is correct |
30 | Correct | 7 ms | 384 KB | Output is correct |
31 | Correct | 6 ms | 512 KB | Output is correct |
32 | Correct | 6 ms | 512 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
3 | Correct | 4 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 4 ms | 384 KB | Output is correct |
6 | Correct | 4 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
8 | Correct | 5 ms | 384 KB | Output is correct |
9 | Correct | 5 ms | 384 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 4 ms | 384 KB | Output is correct |
12 | Correct | 5 ms | 384 KB | Output is correct |
13 | Correct | 5 ms | 384 KB | Output is correct |
14 | Correct | 6 ms | 384 KB | Output is correct |
15 | Correct | 7 ms | 512 KB | Output is correct |
16 | Correct | 5 ms | 384 KB | Output is correct |
17 | Correct | 7 ms | 384 KB | Output is correct |
18 | Correct | 6 ms | 384 KB | Output is correct |
19 | Correct | 7 ms | 512 KB | Output is correct |
20 | Correct | 7 ms | 384 KB | Output is correct |
21 | Correct | 6 ms | 384 KB | Output is correct |
22 | Correct | 6 ms | 384 KB | Output is correct |
23 | Correct | 6 ms | 384 KB | Output is correct |
24 | Correct | 6 ms | 384 KB | Output is correct |
25 | Correct | 6 ms | 384 KB | Output is correct |
26 | Correct | 7 ms | 512 KB | Output is correct |
27 | Correct | 6 ms | 384 KB | Output is correct |
28 | Correct | 7 ms | 512 KB | Output is correct |
29 | Correct | 6 ms | 512 KB | Output is correct |
30 | Correct | 7 ms | 384 KB | Output is correct |
31 | Correct | 6 ms | 512 KB | Output is correct |
32 | Correct | 6 ms | 512 KB | Output is correct |
33 | Correct | 236 ms | 13944 KB | Output is correct |
34 | Correct | 275 ms | 14304 KB | Output is correct |
35 | Correct | 229 ms | 13944 KB | Output is correct |
36 | Correct | 273 ms | 14456 KB | Output is correct |
37 | Correct | 270 ms | 14840 KB | Output is correct |
38 | Correct | 266 ms | 14712 KB | Output is correct |
39 | Correct | 287 ms | 13688 KB | Output is correct |
40 | Correct | 283 ms | 13792 KB | Output is correct |
41 | Correct | 281 ms | 13908 KB | Output is correct |
42 | Correct | 285 ms | 13736 KB | Output is correct |
43 | Correct | 308 ms | 13560 KB | Output is correct |
44 | Correct | 218 ms | 13176 KB | Output is correct |
45 | Correct | 224 ms | 13280 KB | Output is correct |
46 | Correct | 236 ms | 13176 KB | Output is correct |
47 | Correct | 177 ms | 13432 KB | Output is correct |
48 | Correct | 185 ms | 13560 KB | Output is correct |
49 | Correct | 309 ms | 14072 KB | Output is correct |
50 | Correct | 282 ms | 14100 KB | Output is correct |
51 | Correct | 279 ms | 14200 KB | Output is correct |
52 | Correct | 315 ms | 14072 KB | Output is correct |
53 | Correct | 276 ms | 14072 KB | Output is correct |