Submission #1108774

# Submission time Handle Problem Language Result Execution time Memory
1108774 2024-11-05T03:47:49 Z Tsagana Energetic turtle (IZhO11_turtle) C++14
10 / 100
65 ms 83632 KB
#include<bits/stdc++.h>

#define IOS ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define all(x) x.begin(), x.end()
#define lnl long long
#define pq priority_queue
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pp pop_back
#define F first
#define S second

using namespace std;

struct row {
	int y[1001][21];
	bool t[1001];
};

int antiloop = 0;

int md;
int n, m;
int k, t;
int a[30];
row X[1001];
map<pair<int, int>, bool> mp;

void solve () {
	cin >> n >> m >> k >> t >> md;

	for (int i = 0; i < k; i++) {
		int x, y; cin >> x >> y;
		X[x].t[y] = 1;
	}
	for (int i = 0; i <= t; i++) X[0].y[0][i] = 0;
		X[0].y[0][0] = 1;

	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= m; j++) {
			if (X[i].t[j]) {
				for (int l = 1; l <= t; l++) {
					if (i) X[i].y[j][l] += X[i-1].y[j][l-1];
					if (j) X[i].y[j][l] += X[i].y[j-1][l-1];
					X[i].y[j][l] %= md;
				}
			}
			else {
				for (int l = 0; l <= t; l++) {
					if (i) X[i].y[j][l] += X[i-1].y[j][l];
					if (j) X[i].y[j][l] += X[i].y[j-1][l];
					X[i].y[j][l] %= md;
				}
			}
		}
	}

	int ans = 0;
	for (int i = 0; i <= t; i++) {
		ans += X[n].y[m][i];
	}
	cout << ans;
}
int main() {IOS solve(); return 0;}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 2384 KB Output is correct
3 Incorrect 1 ms 4432 KB Output isn't correct
4 Incorrect 2 ms 8784 KB Output isn't correct
5 Incorrect 4 ms 15184 KB Output isn't correct
6 Incorrect 15 ms 30544 KB Output isn't correct
7 Incorrect 29 ms 49488 KB Output isn't correct
8 Incorrect 65 ms 83632 KB Output isn't correct
9 Runtime error 5 ms 604 KB Execution killed with signal 11
10 Runtime error 5 ms 528 KB Execution killed with signal 11
11 Runtime error 5 ms 592 KB Execution killed with signal 11
12 Runtime error 5 ms 592 KB Execution killed with signal 11
13 Runtime error 5 ms 532 KB Execution killed with signal 11
14 Runtime error 5 ms 592 KB Execution killed with signal 11
15 Runtime error 5 ms 592 KB Execution killed with signal 11
16 Runtime error 5 ms 592 KB Execution killed with signal 11
17 Runtime error 5 ms 592 KB Execution killed with signal 11
18 Runtime error 5 ms 592 KB Execution killed with signal 11
19 Runtime error 5 ms 592 KB Execution killed with signal 11
20 Runtime error 5 ms 592 KB Execution killed with signal 11