Submission #1113807

# Submission time Handle Problem Language Result Execution time Memory
1113807 2024-11-17T13:31:58 Z Aviansh Cryptography (NOI20_crypto) C++17
14 / 100
239 ms 44200 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;

int fac[100005];
int mod = 1e9+7;

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

    long long ans = 0;
    for(int 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 848 KB Output is correct
2 Correct 2 ms 848 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 848 KB Output is correct
2 Correct 2 ms 848 KB Output is correct
3 Correct 1 ms 848 KB Output is correct
4 Correct 2 ms 848 KB Output is correct
5 Correct 2 ms 848 KB Output is correct
6 Correct 1 ms 696 KB Output is correct
7 Correct 2 ms 848 KB Output is correct
8 Correct 2 ms 848 KB Output is correct
9 Correct 1 ms 848 KB Output is correct
10 Correct 1 ms 848 KB Output is correct
11 Correct 1 ms 848 KB Output is correct
12 Correct 2 ms 848 KB Output is correct
13 Correct 1 ms 848 KB Output is correct
14 Correct 1 ms 848 KB Output is correct
15 Correct 1 ms 848 KB Output is correct
16 Correct 1 ms 848 KB Output is correct
17 Correct 1 ms 848 KB Output is correct
18 Correct 1 ms 848 KB Output is correct
19 Correct 1 ms 848 KB Output is correct
20 Correct 2 ms 848 KB Output is correct
21 Correct 2 ms 1016 KB Output is correct
22 Correct 1 ms 848 KB Output is correct
23 Correct 2 ms 848 KB Output is correct
24 Correct 1 ms 848 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1020 KB Output is correct
2 Runtime error 239 ms 44012 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 848 KB Output is correct
2 Runtime error 230 ms 44200 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 848 KB Output is correct
2 Incorrect 2 ms 848 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 848 KB Output is correct
2 Correct 2 ms 848 KB Output is correct
3 Correct 1 ms 848 KB Output is correct
4 Correct 2 ms 848 KB Output is correct
5 Correct 2 ms 848 KB Output is correct
6 Correct 1 ms 696 KB Output is correct
7 Correct 2 ms 848 KB Output is correct
8 Correct 2 ms 848 KB Output is correct
9 Correct 1 ms 848 KB Output is correct
10 Correct 1 ms 848 KB Output is correct
11 Correct 1 ms 848 KB Output is correct
12 Correct 2 ms 848 KB Output is correct
13 Correct 1 ms 848 KB Output is correct
14 Correct 1 ms 848 KB Output is correct
15 Correct 1 ms 848 KB Output is correct
16 Correct 1 ms 848 KB Output is correct
17 Correct 1 ms 848 KB Output is correct
18 Correct 1 ms 848 KB Output is correct
19 Correct 1 ms 848 KB Output is correct
20 Correct 2 ms 848 KB Output is correct
21 Correct 2 ms 1016 KB Output is correct
22 Correct 1 ms 848 KB Output is correct
23 Correct 2 ms 848 KB Output is correct
24 Correct 1 ms 848 KB Output is correct
25 Correct 1 ms 848 KB Output is correct
26 Incorrect 2 ms 848 KB Output isn't correct
27 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 848 KB Output is correct
2 Runtime error 230 ms 44200 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 848 KB Output is correct
2 Correct 2 ms 848 KB Output is correct
3 Correct 1 ms 848 KB Output is correct
4 Correct 2 ms 848 KB Output is correct
5 Correct 2 ms 848 KB Output is correct
6 Correct 1 ms 696 KB Output is correct
7 Correct 2 ms 848 KB Output is correct
8 Correct 2 ms 848 KB Output is correct
9 Correct 1 ms 848 KB Output is correct
10 Correct 1 ms 848 KB Output is correct
11 Correct 1 ms 848 KB Output is correct
12 Correct 2 ms 848 KB Output is correct
13 Correct 1 ms 848 KB Output is correct
14 Correct 1 ms 848 KB Output is correct
15 Correct 1 ms 848 KB Output is correct
16 Correct 1 ms 848 KB Output is correct
17 Correct 1 ms 848 KB Output is correct
18 Correct 1 ms 848 KB Output is correct
19 Correct 1 ms 848 KB Output is correct
20 Correct 2 ms 848 KB Output is correct
21 Correct 2 ms 1016 KB Output is correct
22 Correct 1 ms 848 KB Output is correct
23 Correct 2 ms 848 KB Output is correct
24 Correct 1 ms 848 KB Output is correct
25 Correct 1 ms 1020 KB Output is correct
26 Runtime error 239 ms 44012 KB Execution killed with signal 11
27 Halted 0 ms 0 KB -