Submission #88664

# Submission time Handle Problem Language Result Execution time Memory
88664 2018-12-07T09:37:29 Z turbat Energetic turtle (IZhO11_turtle) C++14
40 / 100
53 ms 632 KB
#include <bits/stdc++.h> 
using namespace std; 
int n, m, k, t, z, a, b, ans, d[5][1005][22];
bool u[2002][2002];
int main (){
	cin >> n>> m>> k>> t>> z;
	if (n > 1000 && m > 1000) return 0;
	while(k--){
		cin >> a>> b;
		u[a + 1][b + 1] = 1;
	}
	d[2][1][0] = 1;
	for (int i = 1; i <= n + 1;i++){
		for (int j = 1;j <= m + 1;j++)
				for (int o = 0;o <= t;o++){
					if (u[i][j] && o) d[2][j][o] = (d[2][j][o] + d[1][j][o - 1] + d[2][j - 1][o - 1]) % z;
					if (!u[i][j]) d[2][j][o] = (d[2][j][o] + d[1][j][o] + d[2][j - 1][o]) % z;
				}
		for (int l = 1;l <= 2;l++)
			for (int j = 1;j <= m + 1;j++)
				for (int o = 0;o <= t;o++)
					d[l][j][o] = d[l + 1][j][o];
	}
	for (int i = 0;i <= t;i++)
		ans = (ans + d[1][m + 1][i]) % z;
	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 6 ms 292 KB Output is correct
4 Correct 14 ms 376 KB Output is correct
5 Correct 7 ms 508 KB Output is correct
6 Correct 14 ms 520 KB Output is correct
7 Correct 34 ms 632 KB Output is correct
8 Correct 53 ms 504 KB Output is correct
9 Incorrect 2 ms 348 KB Output isn't correct
10 Incorrect 2 ms 256 KB Output isn't correct
11 Incorrect 2 ms 256 KB Output isn't correct
12 Incorrect 2 ms 376 KB Output isn't correct
13 Incorrect 2 ms 256 KB Output isn't correct
14 Incorrect 2 ms 256 KB Output isn't correct
15 Incorrect 2 ms 256 KB Output isn't correct
16 Incorrect 2 ms 256 KB Output isn't correct
17 Incorrect 2 ms 256 KB Output isn't correct
18 Incorrect 8 ms 252 KB Output isn't correct
19 Incorrect 2 ms 256 KB Output isn't correct
20 Incorrect 2 ms 256 KB Output isn't correct