| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1368638 | wyn | Cryptography (NOI20_crypto) | C++17 | 1094 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;
}
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
