Submission #1113810

# Submission time Handle Problem Language Result Execution time Memory
1113810 2024-11-17T13:35:19 Z Aviansh Cryptography (NOI20_crypto) C++17
35 / 100
300 ms 26896 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;

using namespace std;

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

long long fac[300005];
long long mod = 1e9+7;

signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    fac[1]=1;
    for(long long i = 2;i<=3e5;i++){
        fac[i]=fac[i-1]*i;
        fac[i]%=mod;
    }
    long long n;
    cin >> n;
    long long arr[n];
    ordered_set pts;
    for(long long i = 0;i<n;i++){
        cin >> arr[i];
        pts.insert(arr[i]);
    }

    long long ans = 0;
    for(long long i = 0;i<n;i++){
        ans+=1LL*pts.order_of_key(arr[i])*fac[n-i-1];
        ans%=mod;
        pts.erase(arr[i]);
    }
    ans++;
    cout << ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2640 KB Output is correct
2 Correct 3 ms 2640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2640 KB Output is correct
2 Correct 3 ms 2640 KB Output is correct
3 Correct 3 ms 2640 KB Output is correct
4 Correct 2 ms 2640 KB Output is correct
5 Correct 3 ms 2640 KB Output is correct
6 Correct 2 ms 2640 KB Output is correct
7 Correct 3 ms 2640 KB Output is correct
8 Correct 3 ms 2640 KB Output is correct
9 Correct 3 ms 2640 KB Output is correct
10 Correct 2 ms 2640 KB Output is correct
11 Correct 3 ms 2640 KB Output is correct
12 Correct 3 ms 2640 KB Output is correct
13 Correct 3 ms 2640 KB Output is correct
14 Correct 3 ms 2640 KB Output is correct
15 Correct 4 ms 2640 KB Output is correct
16 Correct 3 ms 2640 KB Output is correct
17 Correct 3 ms 2808 KB Output is correct
18 Correct 3 ms 2640 KB Output is correct
19 Correct 3 ms 2640 KB Output is correct
20 Correct 3 ms 2812 KB Output is correct
21 Correct 3 ms 2640 KB Output is correct
22 Correct 3 ms 2640 KB Output is correct
23 Correct 3 ms 2640 KB Output is correct
24 Correct 2 ms 2640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2812 KB Output is correct
2 Correct 290 ms 23736 KB Output is correct
3 Correct 286 ms 26616 KB Output is correct
4 Correct 293 ms 26700 KB Output is correct
5 Correct 297 ms 26604 KB Output is correct
6 Correct 274 ms 26592 KB Output is correct
7 Correct 295 ms 26696 KB Output is correct
8 Correct 281 ms 26712 KB Output is correct
9 Correct 282 ms 26696 KB Output is correct
10 Correct 281 ms 26696 KB Output is correct
11 Correct 278 ms 26700 KB Output is correct
12 Correct 270 ms 26696 KB Output is correct
13 Correct 284 ms 26896 KB Output is correct
14 Correct 285 ms 26628 KB Output is correct
15 Correct 287 ms 26696 KB Output is correct
16 Correct 266 ms 26696 KB Output is correct
17 Correct 290 ms 26696 KB Output is correct
18 Correct 300 ms 26592 KB Output is correct
19 Correct 282 ms 26696 KB Output is correct
20 Correct 291 ms 26832 KB Output is correct
21 Correct 295 ms 26696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2640 KB Output is correct
2 Correct 275 ms 23872 KB Output is correct
3 Correct 292 ms 25672 KB Output is correct
4 Correct 275 ms 25672 KB Output is correct
5 Correct 265 ms 25680 KB Output is correct
6 Correct 287 ms 25808 KB Output is correct
7 Correct 291 ms 25680 KB Output is correct
8 Correct 272 ms 25880 KB Output is correct
9 Correct 280 ms 25852 KB Output is correct
10 Correct 269 ms 25664 KB Output is correct
11 Correct 279 ms 25672 KB Output is correct
12 Correct 289 ms 25720 KB Output is correct
13 Correct 269 ms 25844 KB Output is correct
14 Correct 278 ms 25796 KB Output is correct
15 Correct 276 ms 25672 KB Output is correct
16 Correct 274 ms 25672 KB Output is correct
17 Correct 268 ms 25672 KB Output is correct
18 Correct 265 ms 25636 KB Output is correct
19 Correct 277 ms 25672 KB Output is correct
20 Correct 298 ms 25672 KB Output is correct
21 Correct 274 ms 25984 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2640 KB Output is correct
2 Correct 3 ms 2896 KB Output is correct
3 Correct 4 ms 2916 KB Output is correct
4 Correct 4 ms 2896 KB Output is correct
5 Correct 4 ms 2896 KB Output is correct
6 Correct 3 ms 2896 KB Output is correct
7 Correct 4 ms 2896 KB Output is correct
8 Correct 3 ms 2896 KB Output is correct
9 Correct 4 ms 2896 KB Output is correct
10 Correct 4 ms 2896 KB Output is correct
11 Correct 4 ms 2896 KB Output is correct
12 Correct 4 ms 2896 KB Output is correct
13 Correct 4 ms 2896 KB Output is correct
14 Correct 4 ms 2896 KB Output is correct
15 Incorrect 3 ms 2640 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2640 KB Output is correct
2 Correct 3 ms 2640 KB Output is correct
3 Correct 3 ms 2640 KB Output is correct
4 Correct 2 ms 2640 KB Output is correct
5 Correct 3 ms 2640 KB Output is correct
6 Correct 2 ms 2640 KB Output is correct
7 Correct 3 ms 2640 KB Output is correct
8 Correct 3 ms 2640 KB Output is correct
9 Correct 3 ms 2640 KB Output is correct
10 Correct 2 ms 2640 KB Output is correct
11 Correct 3 ms 2640 KB Output is correct
12 Correct 3 ms 2640 KB Output is correct
13 Correct 3 ms 2640 KB Output is correct
14 Correct 3 ms 2640 KB Output is correct
15 Correct 4 ms 2640 KB Output is correct
16 Correct 3 ms 2640 KB Output is correct
17 Correct 3 ms 2808 KB Output is correct
18 Correct 3 ms 2640 KB Output is correct
19 Correct 3 ms 2640 KB Output is correct
20 Correct 3 ms 2812 KB Output is correct
21 Correct 3 ms 2640 KB Output is correct
22 Correct 3 ms 2640 KB Output is correct
23 Correct 3 ms 2640 KB Output is correct
24 Correct 2 ms 2640 KB Output is correct
25 Correct 2 ms 2640 KB Output is correct
26 Correct 3 ms 2896 KB Output is correct
27 Correct 4 ms 2916 KB Output is correct
28 Correct 4 ms 2896 KB Output is correct
29 Correct 4 ms 2896 KB Output is correct
30 Correct 3 ms 2896 KB Output is correct
31 Correct 4 ms 2896 KB Output is correct
32 Correct 3 ms 2896 KB Output is correct
33 Correct 4 ms 2896 KB Output is correct
34 Correct 4 ms 2896 KB Output is correct
35 Correct 4 ms 2896 KB Output is correct
36 Correct 4 ms 2896 KB Output is correct
37 Correct 4 ms 2896 KB Output is correct
38 Correct 4 ms 2896 KB Output is correct
39 Incorrect 3 ms 2640 KB Output isn't correct
40 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2640 KB Output is correct
2 Correct 275 ms 23872 KB Output is correct
3 Correct 292 ms 25672 KB Output is correct
4 Correct 275 ms 25672 KB Output is correct
5 Correct 265 ms 25680 KB Output is correct
6 Correct 287 ms 25808 KB Output is correct
7 Correct 291 ms 25680 KB Output is correct
8 Correct 272 ms 25880 KB Output is correct
9 Correct 280 ms 25852 KB Output is correct
10 Correct 269 ms 25664 KB Output is correct
11 Correct 279 ms 25672 KB Output is correct
12 Correct 289 ms 25720 KB Output is correct
13 Correct 269 ms 25844 KB Output is correct
14 Correct 278 ms 25796 KB Output is correct
15 Correct 276 ms 25672 KB Output is correct
16 Correct 274 ms 25672 KB Output is correct
17 Correct 268 ms 25672 KB Output is correct
18 Correct 265 ms 25636 KB Output is correct
19 Correct 277 ms 25672 KB Output is correct
20 Correct 298 ms 25672 KB Output is correct
21 Correct 274 ms 25984 KB Output is correct
22 Correct 2 ms 2640 KB Output is correct
23 Correct 3 ms 2896 KB Output is correct
24 Correct 4 ms 2916 KB Output is correct
25 Correct 4 ms 2896 KB Output is correct
26 Correct 4 ms 2896 KB Output is correct
27 Correct 3 ms 2896 KB Output is correct
28 Correct 4 ms 2896 KB Output is correct
29 Correct 3 ms 2896 KB Output is correct
30 Correct 4 ms 2896 KB Output is correct
31 Correct 4 ms 2896 KB Output is correct
32 Correct 4 ms 2896 KB Output is correct
33 Correct 4 ms 2896 KB Output is correct
34 Correct 4 ms 2896 KB Output is correct
35 Correct 4 ms 2896 KB Output is correct
36 Incorrect 3 ms 2640 KB Output isn't correct
37 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2640 KB Output is correct
2 Correct 3 ms 2640 KB Output is correct
3 Correct 3 ms 2640 KB Output is correct
4 Correct 2 ms 2640 KB Output is correct
5 Correct 3 ms 2640 KB Output is correct
6 Correct 2 ms 2640 KB Output is correct
7 Correct 3 ms 2640 KB Output is correct
8 Correct 3 ms 2640 KB Output is correct
9 Correct 3 ms 2640 KB Output is correct
10 Correct 2 ms 2640 KB Output is correct
11 Correct 3 ms 2640 KB Output is correct
12 Correct 3 ms 2640 KB Output is correct
13 Correct 3 ms 2640 KB Output is correct
14 Correct 3 ms 2640 KB Output is correct
15 Correct 4 ms 2640 KB Output is correct
16 Correct 3 ms 2640 KB Output is correct
17 Correct 3 ms 2808 KB Output is correct
18 Correct 3 ms 2640 KB Output is correct
19 Correct 3 ms 2640 KB Output is correct
20 Correct 3 ms 2812 KB Output is correct
21 Correct 3 ms 2640 KB Output is correct
22 Correct 3 ms 2640 KB Output is correct
23 Correct 3 ms 2640 KB Output is correct
24 Correct 2 ms 2640 KB Output is correct
25 Correct 3 ms 2812 KB Output is correct
26 Correct 290 ms 23736 KB Output is correct
27 Correct 286 ms 26616 KB Output is correct
28 Correct 293 ms 26700 KB Output is correct
29 Correct 297 ms 26604 KB Output is correct
30 Correct 274 ms 26592 KB Output is correct
31 Correct 295 ms 26696 KB Output is correct
32 Correct 281 ms 26712 KB Output is correct
33 Correct 282 ms 26696 KB Output is correct
34 Correct 281 ms 26696 KB Output is correct
35 Correct 278 ms 26700 KB Output is correct
36 Correct 270 ms 26696 KB Output is correct
37 Correct 284 ms 26896 KB Output is correct
38 Correct 285 ms 26628 KB Output is correct
39 Correct 287 ms 26696 KB Output is correct
40 Correct 266 ms 26696 KB Output is correct
41 Correct 290 ms 26696 KB Output is correct
42 Correct 300 ms 26592 KB Output is correct
43 Correct 282 ms 26696 KB Output is correct
44 Correct 291 ms 26832 KB Output is correct
45 Correct 295 ms 26696 KB Output is correct
46 Correct 3 ms 2640 KB Output is correct
47 Correct 275 ms 23872 KB Output is correct
48 Correct 292 ms 25672 KB Output is correct
49 Correct 275 ms 25672 KB Output is correct
50 Correct 265 ms 25680 KB Output is correct
51 Correct 287 ms 25808 KB Output is correct
52 Correct 291 ms 25680 KB Output is correct
53 Correct 272 ms 25880 KB Output is correct
54 Correct 280 ms 25852 KB Output is correct
55 Correct 269 ms 25664 KB Output is correct
56 Correct 279 ms 25672 KB Output is correct
57 Correct 289 ms 25720 KB Output is correct
58 Correct 269 ms 25844 KB Output is correct
59 Correct 278 ms 25796 KB Output is correct
60 Correct 276 ms 25672 KB Output is correct
61 Correct 274 ms 25672 KB Output is correct
62 Correct 268 ms 25672 KB Output is correct
63 Correct 265 ms 25636 KB Output is correct
64 Correct 277 ms 25672 KB Output is correct
65 Correct 298 ms 25672 KB Output is correct
66 Correct 274 ms 25984 KB Output is correct
67 Correct 2 ms 2640 KB Output is correct
68 Correct 3 ms 2896 KB Output is correct
69 Correct 4 ms 2916 KB Output is correct
70 Correct 4 ms 2896 KB Output is correct
71 Correct 4 ms 2896 KB Output is correct
72 Correct 3 ms 2896 KB Output is correct
73 Correct 4 ms 2896 KB Output is correct
74 Correct 3 ms 2896 KB Output is correct
75 Correct 4 ms 2896 KB Output is correct
76 Correct 4 ms 2896 KB Output is correct
77 Correct 4 ms 2896 KB Output is correct
78 Correct 4 ms 2896 KB Output is correct
79 Correct 4 ms 2896 KB Output is correct
80 Correct 4 ms 2896 KB Output is correct
81 Incorrect 3 ms 2640 KB Output isn't correct
82 Halted 0 ms 0 KB -