# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
224517 | 2020-04-18T09:41:07 Z | Nightlight | Mountains (NOI20_mountains) | C++14 | 938 ms | 48276 KB |
#include <bits/stdc++.h> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/assoc_container.hpp> #define pii pair<long long, int> using namespace std; using namespace __gnu_pbds; typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; int N; long long A[300005]; long long L[300005]; long long ans; ordered_set suf, pre; int main() { scanf("%d", &N); for(int i = 1; i <= N; i++) { scanf("%lld", &A[i]); L[i] = pre.order_of_key({A[i], 0}); pre.insert({A[i], i}); } long long R; for(int i = N; i > 0; i--) { R = suf.order_of_key({A[i], i}); ans += R * L[i]; suf.insert({A[i], i}); } printf("%lld\n", ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 764 ms | 48096 KB | Output is correct |
3 | Correct | 749 ms | 48224 KB | Output is correct |
4 | Correct | 750 ms | 48096 KB | Output is correct |
5 | Correct | 767 ms | 48120 KB | Output is correct |
6 | Correct | 845 ms | 48276 KB | Output is correct |
7 | Correct | 716 ms | 48192 KB | Output is correct |
8 | Correct | 717 ms | 48172 KB | Output is correct |
9 | Correct | 704 ms | 48200 KB | Output is correct |
10 | Correct | 691 ms | 48160 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 348 ms | 43256 KB | Output is correct |
2 | Correct | 339 ms | 43236 KB | Output is correct |
3 | Correct | 353 ms | 43128 KB | Output is correct |
4 | Correct | 330 ms | 43256 KB | Output is correct |
5 | Correct | 339 ms | 43156 KB | Output is correct |
6 | Correct | 313 ms | 43100 KB | Output is correct |
7 | Correct | 333 ms | 43128 KB | Output is correct |
8 | Correct | 636 ms | 43488 KB | Output is correct |
9 | Correct | 667 ms | 43132 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 348 ms | 43256 KB | Output is correct |
2 | Correct | 339 ms | 43236 KB | Output is correct |
3 | Correct | 353 ms | 43128 KB | Output is correct |
4 | Correct | 330 ms | 43256 KB | Output is correct |
5 | Correct | 339 ms | 43156 KB | Output is correct |
6 | Correct | 313 ms | 43100 KB | Output is correct |
7 | Correct | 333 ms | 43128 KB | Output is correct |
8 | Correct | 636 ms | 43488 KB | Output is correct |
9 | Correct | 667 ms | 43132 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 616 ms | 43488 KB | Output is correct |
12 | Correct | 578 ms | 43384 KB | Output is correct |
13 | Correct | 571 ms | 43384 KB | Output is correct |
14 | Correct | 568 ms | 43384 KB | Output is correct |
15 | Correct | 506 ms | 43444 KB | Output is correct |
16 | Correct | 553 ms | 43412 KB | Output is correct |
17 | Correct | 562 ms | 43512 KB | Output is correct |
18 | Correct | 728 ms | 43488 KB | Output is correct |
19 | Correct | 624 ms | 43512 KB | Output is correct |
20 | Correct | 5 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 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 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 384 KB | Output is correct |
6 | Correct | 5 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 | 17 ms | 1920 KB | Output is correct |
12 | Correct | 16 ms | 1920 KB | Output is correct |
13 | Correct | 17 ms | 1920 KB | Output is correct |
14 | Correct | 16 ms | 1920 KB | Output is correct |
15 | Correct | 16 ms | 1920 KB | Output is correct |
16 | Correct | 20 ms | 1920 KB | Output is correct |
17 | Correct | 16 ms | 1920 KB | Output is correct |
18 | Correct | 15 ms | 1920 KB | Output is correct |
19 | Correct | 16 ms | 1792 KB | Output is correct |
20 | Correct | 6 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 348 ms | 43256 KB | Output is correct |
2 | Correct | 339 ms | 43236 KB | Output is correct |
3 | Correct | 353 ms | 43128 KB | Output is correct |
4 | Correct | 330 ms | 43256 KB | Output is correct |
5 | Correct | 339 ms | 43156 KB | Output is correct |
6 | Correct | 313 ms | 43100 KB | Output is correct |
7 | Correct | 333 ms | 43128 KB | Output is correct |
8 | Correct | 636 ms | 43488 KB | Output is correct |
9 | Correct | 667 ms | 43132 KB | Output is correct |
10 | Correct | 5 ms | 384 KB | Output is correct |
11 | Correct | 616 ms | 43488 KB | Output is correct |
12 | Correct | 578 ms | 43384 KB | Output is correct |
13 | Correct | 571 ms | 43384 KB | Output is correct |
14 | Correct | 568 ms | 43384 KB | Output is correct |
15 | Correct | 506 ms | 43444 KB | Output is correct |
16 | Correct | 553 ms | 43412 KB | Output is correct |
17 | Correct | 562 ms | 43512 KB | Output is correct |
18 | Correct | 728 ms | 43488 KB | Output is correct |
19 | Correct | 624 ms | 43512 KB | Output is correct |
20 | Correct | 5 ms | 384 KB | Output is correct |
21 | Correct | 629 ms | 44280 KB | Output is correct |
22 | Correct | 938 ms | 44280 KB | Output is correct |
23 | Correct | 651 ms | 44256 KB | Output is correct |
24 | Correct | 850 ms | 44316 KB | Output is correct |
25 | Correct | 930 ms | 44296 KB | Output is correct |
26 | Correct | 896 ms | 44256 KB | Output is correct |
27 | Correct | 684 ms | 44288 KB | Output is correct |
28 | Correct | 679 ms | 44296 KB | Output is correct |
29 | Correct | 648 ms | 44408 KB | Output is correct |
30 | Correct | 5 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 384 KB | Output is correct |
2 | Correct | 764 ms | 48096 KB | Output is correct |
3 | Correct | 749 ms | 48224 KB | Output is correct |
4 | Correct | 750 ms | 48096 KB | Output is correct |
5 | Correct | 767 ms | 48120 KB | Output is correct |
6 | Correct | 845 ms | 48276 KB | Output is correct |
7 | Correct | 716 ms | 48192 KB | Output is correct |
8 | Correct | 717 ms | 48172 KB | Output is correct |
9 | Correct | 704 ms | 48200 KB | Output is correct |
10 | Correct | 691 ms | 48160 KB | Output is correct |
11 | Correct | 348 ms | 43256 KB | Output is correct |
12 | Correct | 339 ms | 43236 KB | Output is correct |
13 | Correct | 353 ms | 43128 KB | Output is correct |
14 | Correct | 330 ms | 43256 KB | Output is correct |
15 | Correct | 339 ms | 43156 KB | Output is correct |
16 | Correct | 313 ms | 43100 KB | Output is correct |
17 | Correct | 333 ms | 43128 KB | Output is correct |
18 | Correct | 636 ms | 43488 KB | Output is correct |
19 | Correct | 667 ms | 43132 KB | Output is correct |
20 | Correct | 5 ms | 384 KB | Output is correct |
21 | Correct | 616 ms | 43488 KB | Output is correct |
22 | Correct | 578 ms | 43384 KB | Output is correct |
23 | Correct | 571 ms | 43384 KB | Output is correct |
24 | Correct | 568 ms | 43384 KB | Output is correct |
25 | Correct | 506 ms | 43444 KB | Output is correct |
26 | Correct | 553 ms | 43412 KB | Output is correct |
27 | Correct | 562 ms | 43512 KB | Output is correct |
28 | Correct | 728 ms | 43488 KB | Output is correct |
29 | Correct | 624 ms | 43512 KB | Output is correct |
30 | Correct | 5 ms | 384 KB | Output is correct |
31 | Correct | 5 ms | 384 KB | Output is correct |
32 | Correct | 5 ms | 384 KB | Output is correct |
33 | Correct | 5 ms | 384 KB | Output is correct |
34 | Correct | 5 ms | 384 KB | Output is correct |
35 | Correct | 5 ms | 384 KB | Output is correct |
36 | Correct | 5 ms | 384 KB | Output is correct |
37 | Correct | 5 ms | 384 KB | Output is correct |
38 | Correct | 5 ms | 384 KB | Output is correct |
39 | Correct | 5 ms | 384 KB | Output is correct |
40 | Correct | 5 ms | 384 KB | Output is correct |
41 | Correct | 17 ms | 1920 KB | Output is correct |
42 | Correct | 16 ms | 1920 KB | Output is correct |
43 | Correct | 17 ms | 1920 KB | Output is correct |
44 | Correct | 16 ms | 1920 KB | Output is correct |
45 | Correct | 16 ms | 1920 KB | Output is correct |
46 | Correct | 20 ms | 1920 KB | Output is correct |
47 | Correct | 16 ms | 1920 KB | Output is correct |
48 | Correct | 15 ms | 1920 KB | Output is correct |
49 | Correct | 16 ms | 1792 KB | Output is correct |
50 | Correct | 6 ms | 384 KB | Output is correct |
51 | Correct | 629 ms | 44280 KB | Output is correct |
52 | Correct | 938 ms | 44280 KB | Output is correct |
53 | Correct | 651 ms | 44256 KB | Output is correct |
54 | Correct | 850 ms | 44316 KB | Output is correct |
55 | Correct | 930 ms | 44296 KB | Output is correct |
56 | Correct | 896 ms | 44256 KB | Output is correct |
57 | Correct | 684 ms | 44288 KB | Output is correct |
58 | Correct | 679 ms | 44296 KB | Output is correct |
59 | Correct | 648 ms | 44408 KB | Output is correct |
60 | Correct | 5 ms | 384 KB | Output is correct |
61 | Correct | 698 ms | 48096 KB | Output is correct |
62 | Correct | 861 ms | 48100 KB | Output is correct |
63 | Correct | 646 ms | 48144 KB | Output is correct |
64 | Correct | 661 ms | 48120 KB | Output is correct |
65 | Correct | 783 ms | 48120 KB | Output is correct |
66 | Correct | 834 ms | 48120 KB | Output is correct |
67 | Correct | 838 ms | 48060 KB | Output is correct |
68 | Correct | 702 ms | 48160 KB | Output is correct |
69 | Correct | 661 ms | 44472 KB | Output is correct |
70 | Correct | 4 ms | 384 KB | Output is correct |