Submission #366019

# Submission time Handle Problem Language Result Execution time Memory
366019 2021-02-12T18:17:46 Z kostia244 Calvinball championship (CEOI15_teams) C++17
0 / 100
216 ms 620 KB
#include<bits/stdc++.h>
#define all(x) begin(x), end(x)
using namespace std;
using ll = long long;
const int maxn = 1e4+1, mod = 1e6 + 7;
using state = array<int, maxn>;
int n;
state def;
void add(int &a, int b) { a = a+b>=mod?a+b-mod:a+b; }
int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin >> n;
	def.fill(0);
	state dp = def;
	int lk = 0;
	for(int A, i = 1; i <= n; i++) {
		cin >> A;
		lk = max(lk, A);
		auto ndp = def;
		for(int k = 0; k < i; k++) {
			ndp[k] = (ndp[k] + dp[k]*1ll*k)%mod;
			add(ndp[k+1], dp[k]);
		}
		add(ndp[lk], A-1);
		dp = ndp;
		//for(int i = 0; i <= n; i++) cout << dp[i] << " "; cout << endl;
	}
	int sm = 0;
	for(int i = 0; i <= n; i++) add(sm, dp[i]);
	cout << sm << '\n';
}
	
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 492 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 492 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 492 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 492 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 492 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 492 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 492 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 216 ms 492 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 62 ms 620 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 206 ms 492 KB Output isn't correct
2 Halted 0 ms 0 KB -