Submission #971187

# Submission time Handle Problem Language Result Execution time Memory
971187 2024-04-28T06:07:59 Z amirujuz Energetic turtle (IZhO11_turtle) C++14
0 / 100
3 ms 4752 KB
#include <bits/stdc++.h>
#define allr v.rbegin(), v.rend()
#define sllr s.rbegin(), s.rend()
#define all v.begin(), s.end()
#define sll s.begin(), s.end()
#define pii pair <int, int>
#define int long long
#define pb push_back
#define pp pop_back
#define sc second
#define fr first
using namespace std;
const int N=1e3+7, INT=1e6+7, INF=1e9+7, INFF=INT64_MAX;
int dp[N][N], siu[N][N];
signed main() {
	ios_base::sync_with_stdio(false);
	ofstream cout ("turtle.out");
	ifstream  cin ("turtle.in");
	cout.tie(NULL);
	cin.tie(NULL);
	int n, m, k, t, z, a, b, i, j;
	cin >> n >> m >> k >> t >> z;
	map <pii, int> mp;
	for (i=0; i<k; i++) {
		cin >> a >> b;
		mp[{a+1, b+1}]=1;
	}
	dp[1][1]=1;
	for (i=1; i<=n+1; i++) {
		for (j=1; j<=m+1; j++) {
			if (mp[{i, j}]+siu[i-1][j]<=t) siu[i][j]+=siu[i-1][j]+mp[{i, j}], dp[i][j]+=dp[i-1][j];
			if (mp[{i, j}]+siu[i][j-1]<=t) siu[i][j]+=siu[i][j-1]+mp[{i, j}], dp[i][j]+=dp[i][j-1];
			dp[i][j]%=z;
		}
	}
	cout << dp[n+1][m+1];
}
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 4696 KB Execution killed with signal 8
2 Runtime error 3 ms 4700 KB Execution killed with signal 8
3 Runtime error 3 ms 4700 KB Execution killed with signal 8
4 Runtime error 3 ms 4700 KB Execution killed with signal 8
5 Runtime error 3 ms 4700 KB Execution killed with signal 8
6 Runtime error 3 ms 4700 KB Execution killed with signal 8
7 Runtime error 3 ms 4700 KB Execution killed with signal 8
8 Runtime error 3 ms 4700 KB Execution killed with signal 8
9 Runtime error 3 ms 4700 KB Execution killed with signal 8
10 Runtime error 3 ms 4700 KB Execution killed with signal 8
11 Runtime error 3 ms 4700 KB Execution killed with signal 8
12 Runtime error 3 ms 4700 KB Execution killed with signal 8
13 Runtime error 3 ms 4752 KB Execution killed with signal 8
14 Runtime error 3 ms 4700 KB Execution killed with signal 8
15 Runtime error 3 ms 4700 KB Execution killed with signal 8
16 Runtime error 3 ms 4696 KB Execution killed with signal 8
17 Runtime error 3 ms 4700 KB Execution killed with signal 8
18 Runtime error 3 ms 4700 KB Execution killed with signal 8
19 Runtime error 3 ms 4700 KB Execution killed with signal 8
20 Runtime error 3 ms 4700 KB Execution killed with signal 8