답안 #1113805

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1113805 2024-11-17T13:30:25 Z Aviansh Cryptography (NOI20_crypto) C++17
14 / 100
205 ms 32328 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<int,null_type,less<int>,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;
    int arr[n];
    ordered_set pts;
    for(int &i : arr){
        cin >> i;
        pts.insert(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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 848 KB Output is correct
2 Correct 2 ms 636 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 848 KB Output is correct
2 Correct 2 ms 636 KB Output is correct
3 Correct 2 ms 848 KB Output is correct
4 Correct 1 ms 848 KB Output is correct
5 Correct 1 ms 848 KB Output is correct
6 Correct 1 ms 848 KB Output is correct
7 Correct 2 ms 848 KB Output is correct
8 Correct 1 ms 848 KB Output is correct
9 Correct 1 ms 848 KB Output is correct
10 Correct 2 ms 1016 KB Output is correct
11 Correct 1 ms 848 KB Output is correct
12 Correct 2 ms 1016 KB Output is correct
13 Correct 2 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 1016 KB Output is correct
20 Correct 2 ms 848 KB Output is correct
21 Correct 2 ms 848 KB Output is correct
22 Correct 2 ms 848 KB Output is correct
23 Correct 1 ms 848 KB Output is correct
24 Correct 2 ms 848 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 848 KB Output is correct
2 Runtime error 197 ms 32328 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 848 KB Output is correct
2 Runtime error 205 ms 32164 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 848 KB Output is correct
2 Incorrect 3 ms 848 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 848 KB Output is correct
2 Correct 2 ms 636 KB Output is correct
3 Correct 2 ms 848 KB Output is correct
4 Correct 1 ms 848 KB Output is correct
5 Correct 1 ms 848 KB Output is correct
6 Correct 1 ms 848 KB Output is correct
7 Correct 2 ms 848 KB Output is correct
8 Correct 1 ms 848 KB Output is correct
9 Correct 1 ms 848 KB Output is correct
10 Correct 2 ms 1016 KB Output is correct
11 Correct 1 ms 848 KB Output is correct
12 Correct 2 ms 1016 KB Output is correct
13 Correct 2 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 1016 KB Output is correct
20 Correct 2 ms 848 KB Output is correct
21 Correct 2 ms 848 KB Output is correct
22 Correct 2 ms 848 KB Output is correct
23 Correct 1 ms 848 KB Output is correct
24 Correct 2 ms 848 KB Output is correct
25 Correct 1 ms 848 KB Output is correct
26 Incorrect 3 ms 848 KB Output isn't correct
27 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 848 KB Output is correct
2 Runtime error 205 ms 32164 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 848 KB Output is correct
2 Correct 2 ms 636 KB Output is correct
3 Correct 2 ms 848 KB Output is correct
4 Correct 1 ms 848 KB Output is correct
5 Correct 1 ms 848 KB Output is correct
6 Correct 1 ms 848 KB Output is correct
7 Correct 2 ms 848 KB Output is correct
8 Correct 1 ms 848 KB Output is correct
9 Correct 1 ms 848 KB Output is correct
10 Correct 2 ms 1016 KB Output is correct
11 Correct 1 ms 848 KB Output is correct
12 Correct 2 ms 1016 KB Output is correct
13 Correct 2 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 1016 KB Output is correct
20 Correct 2 ms 848 KB Output is correct
21 Correct 2 ms 848 KB Output is correct
22 Correct 2 ms 848 KB Output is correct
23 Correct 1 ms 848 KB Output is correct
24 Correct 2 ms 848 KB Output is correct
25 Correct 1 ms 848 KB Output is correct
26 Runtime error 197 ms 32328 KB Execution killed with signal 11
27 Halted 0 ms 0 KB -