답안 #466378

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
466378 2021-08-19T05:41:41 Z niloyroot Cryptography (NOI20_crypto) C++14
14 / 100
1000 ms 7876 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pl = pair<ll,ll>;
using vi = vector<ll>;
using ml = map<ll,ll>;
const ll mod=1000000007;
#define pb push_back
#define forp(i,a,b) for(ll i=a;i<=b;i++)
#define forn(i,a,b) for(ll i=a;i>=b;i--)
#define read(a,n) forp(i,1,n){cin>>a[i];}
#define newl '\n'
#define form(m,it) for(auto it=m.begin();it!=m.end(); it++)
#define ff first
#define ss second

void solve(){
    ll n; cin>>n;
    ll p[n+1];
    forp(i,1,n){
        cin>>p[i];
    }
    ll fact[n+1]; fact[0]=1;
    forp(i,1,n){
        fact[i]=i*fact[i-1]; fact[i]%=mod;
    }
    ll a1,ans=0,c=0;
    forp(i,1,n){
        a1=1; c=0;
        forp(j,i+1,n){
            if(p[j]<p[i]){
                c++;
            }
        }
        a1*=c; a1%=mod;
        a1*=fact[n-i]; a1%=mod;
        ans+=a1; ans%=mod;
    }
    cout<<ans+1<<newl;
}

int main() {
    clock_t start,end;
    start=clock();
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output3.txt", "w", stdout);
    // #endif
    ll t=1;
    //cin>>t;
    while(t--){
        solve();
    }
    end=clock();
    //cout<<newl<<"Time : "<<double(end - start)/double(CLOCKS_PER_SEC)<<newl;
}

Compilation message

Crypto.cpp: In function 'int main()':
Crypto.cpp:43:13: warning: variable 'start' set but not used [-Wunused-but-set-variable]
   43 |     clock_t start,end;
      |             ^~~~~
Crypto.cpp:43:19: warning: variable 'end' set but not used [-Wunused-but-set-variable]
   43 |     clock_t start,end;
      |                   ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 316 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 320 KB Output is correct
2 Execution timed out 1074 ms 7876 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Execution timed out 1081 ms 6848 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 15 ms 368 KB Output is correct
3 Correct 16 ms 368 KB Output is correct
4 Correct 14 ms 332 KB Output is correct
5 Correct 14 ms 372 KB Output is correct
6 Correct 15 ms 460 KB Output is correct
7 Correct 14 ms 372 KB Output is correct
8 Correct 14 ms 372 KB Output is correct
9 Correct 15 ms 376 KB Output is correct
10 Correct 14 ms 332 KB Output is correct
11 Correct 14 ms 376 KB Output is correct
12 Correct 14 ms 372 KB Output is correct
13 Correct 14 ms 372 KB Output is correct
14 Correct 15 ms 376 KB Output is correct
15 Incorrect 0 ms 204 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 316 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 15 ms 368 KB Output is correct
27 Correct 16 ms 368 KB Output is correct
28 Correct 14 ms 332 KB Output is correct
29 Correct 14 ms 372 KB Output is correct
30 Correct 15 ms 460 KB Output is correct
31 Correct 14 ms 372 KB Output is correct
32 Correct 14 ms 372 KB Output is correct
33 Correct 15 ms 376 KB Output is correct
34 Correct 14 ms 332 KB Output is correct
35 Correct 14 ms 376 KB Output is correct
36 Correct 14 ms 372 KB Output is correct
37 Correct 14 ms 372 KB Output is correct
38 Correct 15 ms 376 KB Output is correct
39 Incorrect 0 ms 204 KB Output isn't correct
40 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Execution timed out 1081 ms 6848 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 316 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 320 KB Output is correct
26 Execution timed out 1074 ms 7876 KB Time limit exceeded
27 Halted 0 ms 0 KB -