답안 #948345

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
948345 2024-03-18T04:37:22 Z Lilypad Cryptography (NOI20_crypto) C++14
14 / 100
1000 ms 10164 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<ll,ll>
#define pb push_back
#define fi first
#define se second

const ll N = 3e5+3;
const ll MOD = 1e9+7;

ll a[N],b[N],fac[N];
ll n,tmp,ans;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	fac[0] = 1;
	for(int i=1; i<=n; i++) {
		cin >> a[i];
		b[i] = a[i];
		fac[i] = fac[i-1] * i;
		fac[i] %= MOD;
	}
//	sort(b+1,b+n+1);
//	for(int i=1; i<=n; i++) {
//		mp[b[i]] = i;
//	}
//	for(int i=1; i<=n; i++) a[i] = mp[a[i]];
	for(int i=1; i<=n; i++) {
		tmp = 0;
		for(int j=i+1; j<=n; j++) {
			if(a[i] > a[j]) tmp++;
		}
		ans += (fac[n-i] * tmp) % MOD;
		ans %= MOD;
	}
	cout << ans + 1 << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4456 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4456 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4440 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 1 ms 4444 KB Output is correct
17 Correct 1 ms 4696 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4444 KB Output is correct
21 Correct 1 ms 4444 KB Output is correct
22 Correct 1 ms 4444 KB Output is correct
23 Correct 1 ms 4444 KB Output is correct
24 Correct 1 ms 4444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4700 KB Output is correct
2 Execution timed out 1050 ms 10164 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Execution timed out 1071 ms 9352 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 4 ms 4444 KB Output is correct
3 Correct 4 ms 4444 KB Output is correct
4 Correct 4 ms 4444 KB Output is correct
5 Correct 4 ms 4444 KB Output is correct
6 Correct 4 ms 4444 KB Output is correct
7 Correct 4 ms 4444 KB Output is correct
8 Correct 4 ms 4444 KB Output is correct
9 Correct 4 ms 4444 KB Output is correct
10 Correct 4 ms 4444 KB Output is correct
11 Correct 4 ms 4444 KB Output is correct
12 Correct 4 ms 4444 KB Output is correct
13 Correct 4 ms 4604 KB Output is correct
14 Correct 4 ms 4444 KB Output is correct
15 Incorrect 1 ms 4444 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4456 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4440 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 1 ms 4444 KB Output is correct
17 Correct 1 ms 4696 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4444 KB Output is correct
21 Correct 1 ms 4444 KB Output is correct
22 Correct 1 ms 4444 KB Output is correct
23 Correct 1 ms 4444 KB Output is correct
24 Correct 1 ms 4444 KB Output is correct
25 Correct 1 ms 4440 KB Output is correct
26 Correct 4 ms 4444 KB Output is correct
27 Correct 4 ms 4444 KB Output is correct
28 Correct 4 ms 4444 KB Output is correct
29 Correct 4 ms 4444 KB Output is correct
30 Correct 4 ms 4444 KB Output is correct
31 Correct 4 ms 4444 KB Output is correct
32 Correct 4 ms 4444 KB Output is correct
33 Correct 4 ms 4444 KB Output is correct
34 Correct 4 ms 4444 KB Output is correct
35 Correct 4 ms 4444 KB Output is correct
36 Correct 4 ms 4444 KB Output is correct
37 Correct 4 ms 4604 KB Output is correct
38 Correct 4 ms 4444 KB Output is correct
39 Incorrect 1 ms 4444 KB Output isn't correct
40 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Execution timed out 1071 ms 9352 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4456 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 1 ms 4440 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 1 ms 4444 KB Output is correct
17 Correct 1 ms 4696 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4444 KB Output is correct
21 Correct 1 ms 4444 KB Output is correct
22 Correct 1 ms 4444 KB Output is correct
23 Correct 1 ms 4444 KB Output is correct
24 Correct 1 ms 4444 KB Output is correct
25 Correct 1 ms 4700 KB Output is correct
26 Execution timed out 1050 ms 10164 KB Time limit exceeded
27 Halted 0 ms 0 KB -