Submission #88670

# Submission time Handle Problem Language Result Execution time Memory
88670 2018-12-07T10:58:31 Z Badral Energetic turtle (IZhO11_turtle) C++17
5 / 100
155 ms 98860 KB
#include<bits/stdc++.h>
#define maxn 1005
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
using namespace std;
typedef long long ll;
int ans;
bool a[maxn][maxn];
int b[maxn][maxn][25];
int n, m, k1, t, z;
 
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;
	}
	b[0][0][0] = 1;
	for(int i = 0; i <= n; i++) {
		for(int j = 0; j <= m; j++) {
			if(i == 0 && j == 0) {continue; }
			if(a[i][j] == 1) {
				for(int o = 1; o <= t; o++) {
					if(i > 0)
						b[i][j][o] += b[i-1][j][o - 1];
					if(j > 0)
						b[i][j][o] += b[i][j][o - 1];
					b[i][j][o] %= z;
				}
			}
			else {
				for(int o = 0; o <= t; o++) {
					if(i > 0)
						b[i][j][o] += b[i - 1][j][o];
					if(j > 0)
						b[i][j][o] += b[i][j - 1][o];
					b[i][j][o] %= z;
				}
			}
		}
	}
	for(int i = 0; i <= 20; i++) ans += b[n][m][i], ans %= z;
	cout<<ans%z;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Incorrect 2 ms 760 KB Output isn't correct
4 Incorrect 3 ms 1244 KB Output isn't correct
5 Incorrect 9 ms 4060 KB Output isn't correct
6 Incorrect 41 ms 26972 KB Output isn't correct
7 Incorrect 75 ms 42876 KB Output isn't correct
8 Incorrect 155 ms 98860 KB Output isn't correct
9 Runtime error 8 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 8 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 7 ms 428 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 8 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 8 ms 504 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 8 ms 508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 8 ms 424 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 7 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 7 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)