Submission #88668

#TimeUsernameProblemLanguageResultExecution timeMemory
88668BadralEnergetic turtle (IZhO11_turtle)C++17
10 / 100
2089 ms1340 KiB
#include<bits/stdc++.h>
#define maxn 10005
#define mp make_pair
using namespace std;
typedef long long ll;
int ans;
bool a[maxn][maxn];
	int n, m, k1, t, z;
inline void lol(int x, int y, int k) {
	if(x == n && y == m) ans++;
	if(x < n) {
		if(a[x+1][y] == 1 && k > 0) {
			lol(x+1, y, k-1);
		}
		if(a[x+1][y] == 0) {
			lol(x+1, y, k);
		}
	}
	if(y < m) {
		if(a[x][y+1] == 1 && k > 0) {
			lol(x, y+1, k-1);
		}
		if(a[x][y+1] == 0) {
			lol(x, y+1, k);
		}
	}
}
int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >>n >>m >>k1 >>t >>z;
	while(k1--) {
		int x, y;
		cin >>x >>y;
		a[x][y] = 1;
	}
	lol(0, 0, t);
	cout<<ans%z;
}
#Verdict Execution timeMemoryGrader output
Fetching results...