Submission #527164

# Submission time Handle Problem Language Result Execution time Memory
527164 2022-02-17T03:04:28 Z squiddy Calvinball championship (CEOI15_teams) C++14
50 / 100
7 ms 4556 KB
#include <bits/stdc++.h>

using namespace std;
#define FOR(v, s, e) for (int v = s; v < e; v++)
#define FOR_REV(v, s, e) for (int v = e - 1; v >= s; v--)

#define MOD 1000007
int n, ans, cmax = 1;
int pf[105][105][105];

int main() {
	cin >> n;
	if (n > 100) return 1;
	FOR(i, 0, n) {
		FOR(k, 0, n) 
			pf[0][i][k + 1] = pf[0][i][k] + 1;
	}
	FOR(i, 1, n) {
		FOR(j, 0, n) {
			FOR(k, 0, n) {

				pf[i][j][k + 1] = (pf[i][j][k] + pf[i - 1][j][j + 1] + pf[i - 1][j + 1][j + 2] - pf[i - 1][j + 1][j + 1]) % MOD;
			}
		}
	}
	FOR_REV(i, 0, n) {
		int cval;
		cin >> cval;
		ans = (ans + pf[i][cmax - 1][cval - 1]) % MOD;
		cmax = max(cmax, cval);
	}
	cout << (ans + 1) % MOD;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 4428 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 4556 KB Output is correct
2 Correct 6 ms 4556 KB Output is correct
3 Correct 6 ms 4520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 204 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 204 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 204 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 204 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 204 KB Execution failed because the return code was nonzero
2 Halted 0 ms 0 KB -