#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;
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() {
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 |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Execution timed out |
2032 ms |
376 KB |
Time limit exceeded |
4 |
Execution timed out |
2024 ms |
376 KB |
Time limit exceeded |
5 |
Execution timed out |
2081 ms |
376 KB |
Time limit exceeded |
6 |
Execution timed out |
2048 ms |
376 KB |
Time limit exceeded |
7 |
Execution timed out |
2071 ms |
476 KB |
Time limit exceeded |
8 |
Execution timed out |
2035 ms |
376 KB |
Time limit exceeded |
9 |
Execution timed out |
2028 ms |
888 KB |
Time limit exceeded |
10 |
Execution timed out |
2013 ms |
1400 KB |
Time limit exceeded |
11 |
Runtime error |
7 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
12 |
Runtime error |
7 ms |
376 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
13 |
Runtime error |
9 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
14 |
Runtime error |
7 ms |
376 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
15 |
Runtime error |
7 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
16 |
Runtime error |
7 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
17 |
Runtime error |
8 ms |
380 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
18 |
Runtime error |
7 ms |
380 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
19 |
Runtime error |
7 ms |
376 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
20 |
Runtime error |
8 ms |
408 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |