| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1368639 | m0rtu_us0512 | Cryptography (NOI20_crypto) | C++20 | 1096 ms | 2628 KiB |
#include <bits/stdc++.h>
using namespace std;
int64_t N;
vector<int64_t> P;
int64_t fact(int64_t n){
int64_t ans = 1;
for( auto i=2 ; i<=n ; i++ ){
ans = ans*i % 1000000007;
}
return ans;
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cin>>N;
P.assign( N, 0 );
for ( auto &p : P )
cin >> p;
int64_t ans = 1;
for( int64_t i=0 ; i<N ; i++ ){
int64_t smaller=0;
for( int64_t j=i+1 ; j<N ; j++ ){
if( P[j] < P[i] )
smaller++;
}
ans += smaller*fact(N-i-1);
ans %= 1000000007;
}
cout << ans << endl;
return 0;
}
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
