Submission #88618

#TimeUsernameProblemLanguageResultExecution timeMemory
88618turbatEnergetic turtle (IZhO11_turtle)C++14
40 / 100
2108 ms243320 KiB
#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[n + 2][m + 2][t + 1];
	for (int i = 0; i < n + 2;i++)
		for (int j = 0;j < m + 2;j++)
			for (int o = 0;o <= t;o++)
				d[i][j][o] = 0;

	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;
}

Compilation message (stderr)

turtle.cpp: In function 'int main()':
turtle.cpp:13:23: warning: statement has no effect [-Wunused-value]
  d[n + 2][m + 2][t + 1];
  ~~~~~~~~~~~~~~~~~~~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...