답안 #285478

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
285478 2020-08-29T06:55:28 Z achibasadzishvili Mountains (NOI20_mountains) C++14
100 / 100
1213 ms 24184 KB
#include <bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pb push_back
#define mp make_pair
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<pair<long long,long long>, null_type,less<pair<long long,long long> >, rb_tree_tag,tree_order_statistics_node_update>
ll n,ans,a[300005],k[300005];
int main(){
    ordered_set st;
    cin >> n;
    for(int i=1; i<=n; i++){
        cin >> a[i];
        k[i] = st.order_of_key(mp(a[i],-1));
        st.insert(mp(a[i],i));
    }
    st.clear();
    for(int i=n; i>=1; i--){
        k[i] *= st.order_of_key(mp(a[i],-1));
        st.insert(mp(a[i],i));
        ans += k[i];
    }
    cout << ans << '\n';
    
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 921 ms 23928 KB Output is correct
3 Correct 913 ms 23800 KB Output is correct
4 Correct 904 ms 23800 KB Output is correct
5 Correct 918 ms 24056 KB Output is correct
6 Correct 904 ms 24000 KB Output is correct
7 Correct 925 ms 23800 KB Output is correct
8 Correct 933 ms 23800 KB Output is correct
9 Correct 922 ms 24056 KB Output is correct
10 Correct 917 ms 24072 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 379 ms 23804 KB Output is correct
2 Correct 383 ms 23800 KB Output is correct
3 Correct 382 ms 23820 KB Output is correct
4 Correct 386 ms 23800 KB Output is correct
5 Correct 383 ms 23928 KB Output is correct
6 Correct 386 ms 23928 KB Output is correct
7 Correct 387 ms 23800 KB Output is correct
8 Correct 537 ms 23800 KB Output is correct
9 Correct 559 ms 23800 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 379 ms 23804 KB Output is correct
2 Correct 383 ms 23800 KB Output is correct
3 Correct 382 ms 23820 KB Output is correct
4 Correct 386 ms 23800 KB Output is correct
5 Correct 383 ms 23928 KB Output is correct
6 Correct 386 ms 23928 KB Output is correct
7 Correct 387 ms 23800 KB Output is correct
8 Correct 537 ms 23800 KB Output is correct
9 Correct 559 ms 23800 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 775 ms 23972 KB Output is correct
12 Correct 722 ms 23840 KB Output is correct
13 Correct 753 ms 23800 KB Output is correct
14 Correct 764 ms 23916 KB Output is correct
15 Correct 756 ms 24056 KB Output is correct
16 Correct 754 ms 23800 KB Output is correct
17 Correct 737 ms 24056 KB Output is correct
18 Correct 583 ms 23800 KB Output is correct
19 Correct 567 ms 23928 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 23 ms 1152 KB Output is correct
12 Correct 29 ms 1272 KB Output is correct
13 Correct 23 ms 1152 KB Output is correct
14 Correct 24 ms 1152 KB Output is correct
15 Correct 23 ms 1152 KB Output is correct
16 Correct 23 ms 1144 KB Output is correct
17 Correct 23 ms 1152 KB Output is correct
18 Correct 23 ms 1152 KB Output is correct
19 Correct 14 ms 1152 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 379 ms 23804 KB Output is correct
2 Correct 383 ms 23800 KB Output is correct
3 Correct 382 ms 23820 KB Output is correct
4 Correct 386 ms 23800 KB Output is correct
5 Correct 383 ms 23928 KB Output is correct
6 Correct 386 ms 23928 KB Output is correct
7 Correct 387 ms 23800 KB Output is correct
8 Correct 537 ms 23800 KB Output is correct
9 Correct 559 ms 23800 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 775 ms 23972 KB Output is correct
12 Correct 722 ms 23840 KB Output is correct
13 Correct 753 ms 23800 KB Output is correct
14 Correct 764 ms 23916 KB Output is correct
15 Correct 756 ms 24056 KB Output is correct
16 Correct 754 ms 23800 KB Output is correct
17 Correct 737 ms 24056 KB Output is correct
18 Correct 583 ms 23800 KB Output is correct
19 Correct 567 ms 23928 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 935 ms 23848 KB Output is correct
22 Correct 923 ms 24048 KB Output is correct
23 Correct 936 ms 24108 KB Output is correct
24 Correct 918 ms 23852 KB Output is correct
25 Correct 929 ms 23844 KB Output is correct
26 Correct 925 ms 23864 KB Output is correct
27 Correct 943 ms 23900 KB Output is correct
28 Correct 639 ms 23928 KB Output is correct
29 Correct 646 ms 23944 KB Output is correct
30 Correct 0 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 921 ms 23928 KB Output is correct
3 Correct 913 ms 23800 KB Output is correct
4 Correct 904 ms 23800 KB Output is correct
5 Correct 918 ms 24056 KB Output is correct
6 Correct 904 ms 24000 KB Output is correct
7 Correct 925 ms 23800 KB Output is correct
8 Correct 933 ms 23800 KB Output is correct
9 Correct 922 ms 24056 KB Output is correct
10 Correct 917 ms 24072 KB Output is correct
11 Correct 379 ms 23804 KB Output is correct
12 Correct 383 ms 23800 KB Output is correct
13 Correct 382 ms 23820 KB Output is correct
14 Correct 386 ms 23800 KB Output is correct
15 Correct 383 ms 23928 KB Output is correct
16 Correct 386 ms 23928 KB Output is correct
17 Correct 387 ms 23800 KB Output is correct
18 Correct 537 ms 23800 KB Output is correct
19 Correct 559 ms 23800 KB Output is correct
20 Correct 0 ms 384 KB Output is correct
21 Correct 775 ms 23972 KB Output is correct
22 Correct 722 ms 23840 KB Output is correct
23 Correct 753 ms 23800 KB Output is correct
24 Correct 764 ms 23916 KB Output is correct
25 Correct 756 ms 24056 KB Output is correct
26 Correct 754 ms 23800 KB Output is correct
27 Correct 737 ms 24056 KB Output is correct
28 Correct 583 ms 23800 KB Output is correct
29 Correct 567 ms 23928 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 1 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 1 ms 384 KB Output is correct
34 Correct 2 ms 384 KB Output is correct
35 Correct 1 ms 384 KB Output is correct
36 Correct 2 ms 384 KB Output is correct
37 Correct 1 ms 384 KB Output is correct
38 Correct 2 ms 384 KB Output is correct
39 Correct 1 ms 384 KB Output is correct
40 Correct 0 ms 384 KB Output is correct
41 Correct 23 ms 1152 KB Output is correct
42 Correct 29 ms 1272 KB Output is correct
43 Correct 23 ms 1152 KB Output is correct
44 Correct 24 ms 1152 KB Output is correct
45 Correct 23 ms 1152 KB Output is correct
46 Correct 23 ms 1144 KB Output is correct
47 Correct 23 ms 1152 KB Output is correct
48 Correct 23 ms 1152 KB Output is correct
49 Correct 14 ms 1152 KB Output is correct
50 Correct 1 ms 384 KB Output is correct
51 Correct 935 ms 23848 KB Output is correct
52 Correct 923 ms 24048 KB Output is correct
53 Correct 936 ms 24108 KB Output is correct
54 Correct 918 ms 23852 KB Output is correct
55 Correct 929 ms 23844 KB Output is correct
56 Correct 925 ms 23864 KB Output is correct
57 Correct 943 ms 23900 KB Output is correct
58 Correct 639 ms 23928 KB Output is correct
59 Correct 646 ms 23944 KB Output is correct
60 Correct 0 ms 384 KB Output is correct
61 Correct 1168 ms 23952 KB Output is correct
62 Correct 1173 ms 24008 KB Output is correct
63 Correct 1180 ms 23928 KB Output is correct
64 Correct 1177 ms 23804 KB Output is correct
65 Correct 1213 ms 23960 KB Output is correct
66 Correct 1173 ms 24184 KB Output is correct
67 Correct 1205 ms 24020 KB Output is correct
68 Correct 1210 ms 23800 KB Output is correct
69 Correct 948 ms 23928 KB Output is correct
70 Correct 0 ms 384 KB Output is correct