Submission #88671

# Submission time Handle Problem Language Result Execution time Memory
88671 2018-12-07T10:58:58 Z Badral Energetic turtle (IZhO11_turtle) C++17
5 / 100
351 ms 165752 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;
using namespace std;
 
ll n, m, a[maxn][maxn], d[maxn][maxn][21], z, k, t, sum; 
int main () {
	cin>>n >>m >>k >>t >>z;
	for (int i = 1; i <= k; ++i) {
		int x, y;
	  	cin >>x >>y;
		a[x][y] = 1;
	}       
	d[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 q = 1; q <= t; q++) {
				 	if (i > 0)
						d[i][j][q] += d[i-1][j][q - 1];
					if (j > 0)
						d[i][j][q] += d[i][j][q - 1];
					d[i][j][q] %= z;
				}
			}
			else {
				for (int q = 0; q <= t; ++q) {
				  if (i > 0)
						d[i][j][q] += d[i - 1][j][q];
					if (j > 0)
						d[i][j][q] += d[i][j - 1][q];
					d[i][j][q] %= z;				
				}
			}	
		}
	}
	for (int i = 0; i <= t; ++i) {
		sum += d[n][m][i];
		sum %= z;
	} 
	cout<<sum;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 352 KB Output is correct
2 Incorrect 2 ms 380 KB Output isn't correct
3 Incorrect 3 ms 888 KB Output isn't correct
4 Incorrect 3 ms 1528 KB Output isn't correct
5 Incorrect 16 ms 5880 KB Output isn't correct
6 Incorrect 76 ms 43644 KB Output isn't correct
7 Incorrect 156 ms 69608 KB Output isn't correct
8 Incorrect 351 ms 165752 KB Output isn't correct
9 Runtime error 13 ms 408 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 11 ms 472 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 11 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 11 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 11 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 11 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 11 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 12 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 11 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 11 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 12 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 11 ms 440 KB Execution killed with signal 11 (could be triggered by violating memory limits)