Submission #88617

# Submission time Handle Problem Language Result Execution time Memory
88617 2018-12-07T05:29:09 Z turbat Energetic turtle (IZhO11_turtle) C++14
40 / 100
2000 ms 243052 KB
#include <bits/stdc++.h> 
using namespace std; 
 
int n, m, k, t, z, a, b, d[1010][1010][30], ans;
bool u[2002][2002];
 
int main (){
	cin >> n>> m>> k>> t>> z;
	for (int i = 0;i < k;i++){
		cin >> a>> b;
		u[a + 1][b + 1] = 1;
	}
	d[1][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[i][j][o] = (d[i][j][o] + d[i - 1][j][o - 1] + d[i][j - 1][o - 1]) % z;
				if (!u[i][j]) d[i][j][o] = (d[i][j][o] + d[i - 1][j][o] + d[i][j - 1][o]) % z;
			}
		}
	for (int i = 0;i <= t;i++)
		ans = (ans + d[n + 1][m + 1][i]) % z;
	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 3 ms 760 KB Output is correct
4 Correct 3 ms 1272 KB Output is correct
5 Correct 10 ms 4600 KB Output is correct
6 Correct 47 ms 31864 KB Output is correct
7 Correct 86 ms 50712 KB Output is correct
8 Correct 174 ms 119032 KB Output is correct
9 Runtime error 489 ms 243052 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 694 ms 242952 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Execution timed out 2012 ms 53008 KB Time limit exceeded
12 Execution timed out 2060 ms 50800 KB Time limit exceeded
13 Execution timed out 2087 ms 67484 KB Time limit exceeded
14 Execution timed out 2023 ms 56532 KB Time limit exceeded
15 Execution timed out 2099 ms 40500 KB Time limit exceeded
16 Execution timed out 2023 ms 68228 KB Time limit exceeded
17 Execution timed out 2067 ms 73952 KB Time limit exceeded
18 Execution timed out 2086 ms 59404 KB Time limit exceeded
19 Execution timed out 2096 ms 54184 KB Time limit exceeded
20 Execution timed out 2036 ms 44396 KB Time limit exceeded