#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Execution timed out |
2039 ms |
376 KB |
Time limit exceeded |
4 |
Execution timed out |
2044 ms |
376 KB |
Time limit exceeded |
5 |
Execution timed out |
2059 ms |
376 KB |
Time limit exceeded |
6 |
Execution timed out |
2089 ms |
380 KB |
Time limit exceeded |
7 |
Execution timed out |
2036 ms |
424 KB |
Time limit exceeded |
8 |
Execution timed out |
2020 ms |
476 KB |
Time limit exceeded |
9 |
Execution timed out |
2058 ms |
888 KB |
Time limit exceeded |
10 |
Execution timed out |
2019 ms |
1340 KB |
Time limit exceeded |
11 |
Runtime error |
7 ms |
376 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
12 |
Runtime error |
7 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
13 |
Runtime error |
8 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
14 |
Runtime error |
8 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
15 |
Runtime error |
7 ms |
428 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
16 |
Runtime error |
8 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
17 |
Runtime error |
7 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
18 |
Runtime error |
8 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
19 |
Runtime error |
8 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
20 |
Runtime error |
8 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |