Submission #88612

# Submission time Handle Problem Language Result Execution time Memory
88612 2018-12-07T05:24:15 Z turbat Energetic turtle (IZhO11_turtle) C++14
40 / 100
2000 ms 167600 KB
#include <bits/stdc++.h> 
using namespace std; 

int n, m, k, t, z, a, b, d[1002][1002][21], ans;
bool u[1002][1002];

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 376 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 1144 KB Output is correct
5 Correct 9 ms 3576 KB Output is correct
6 Correct 36 ms 23032 KB Output is correct
7 Correct 66 ms 36600 KB Output is correct
8 Correct 131 ms 82808 KB Output is correct
9 Runtime error 396 ms 167600 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 579 ms 167480 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Execution timed out 2057 ms 39276 KB Time limit exceeded
12 Execution timed out 2055 ms 36124 KB Time limit exceeded
13 Execution timed out 2025 ms 51836 KB Time limit exceeded
14 Execution timed out 2040 ms 41508 KB Time limit exceeded
15 Execution timed out 2037 ms 27736 KB Time limit exceeded
16 Execution timed out 2007 ms 50224 KB Time limit exceeded
17 Execution timed out 2088 ms 60508 KB Time limit exceeded
18 Execution timed out 2085 ms 45764 KB Time limit exceeded
19 Execution timed out 2049 ms 39120 KB Time limit exceeded
20 Execution timed out 2045 ms 31972 KB Time limit exceeded