답안 #281261

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
281261 2020-08-23T04:12:21 Z AQT Calvinball championship (CEOI15_teams) C++14
100 / 100
306 ms 608 KB
#include <bits/stdc++.h>

using namespace std;

int N;
int arr[10005];
long long dp[10005];
const int MOD = 1000007;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> N;
	for(int i = 1; i<=N; i++){
		cin >> arr[i];
		dp[i] = 1;
	}
	long long ans = 0;
	for(int i = N; i; i--){
		long long m = *max_element(arr, arr+i);
		ans += min(1LL*arr[i]-1, m) * dp[m];
		for(int j = 1; j<N; j++){
			dp[j] = 1LL * j * dp[j] + dp[j+1];
			dp[j] %= MOD;
		}
		ans %= MOD;
	}
	cout << (ans+1)%MOD;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 416 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 416 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 288 KB Output is correct
2 Correct 2 ms 416 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 255 ms 500 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 73 ms 548 KB Output is correct
2 Correct 81 ms 448 KB Output is correct
3 Correct 68 ms 456 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 275 ms 384 KB Output is correct
2 Correct 290 ms 608 KB Output is correct
3 Correct 306 ms 512 KB Output is correct