Submission #874972

# Submission time Handle Problem Language Result Execution time Memory
874972 2023-11-18T11:16:36 Z SevakYegoryan Energetic turtle (IZhO11_turtle) C++17
10 / 100
1664 ms 262144 KB
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <iomanip>
#include <iterator>
#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <vector>
#include <numeric>
#include <cassert>
#include <limits>
#include <climits>
#include <unordered_set>
#include <unordered_map>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define cdap(k) cout.setf(ios::fixed | ios::showpoint); cout.precision(k);
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define pb push_back
#define ff first
#define ss second
#define mkp make_pair
#define mkt make_tuple
#define pque priority_queue
const int INF = INT_MAX;
const long long LNF = LLONG_MAX;

const int N = 1003;
int x[N], y[N];
int n, m, k, t, z;
map<pair<int, int>, bool> mp;

int dp[N][N][23];

void solve()
{
	int i, j, p;
	ll ans = 0LL;

	cin >> n >> m >> k >> t >> z;
	for (i = 1; i <= k; i++) {
		cin >> x[i] >> y[i];
		mp[{x[i], y[i]}] = true;
	}

	dp[0][0][0] = 1;
	for (p = 0; p <= k; p++) {
		for (i = 0; i <= n; i++) {
			for (j = 0; j <= m; j++) {
				if (i == 0 && j == 0) continue;
				if (!mp[{i, j}]) {
					if (i > 0) dp[i][j][p] += dp[i - 1][j][p];
					if (j > 0) dp[i][j][p] += dp[i][j - 1][p];
				}
				else {
					if (i > 0) dp[i][j][p + 1] += dp[i - 1][j][p];
					if (j > 0) dp[i][j][p + 1] += dp[i][j - 1][p];
				}
			}
		}
	}

	for (i = 0; i <= t; i++) {
		ans += dp[n][m][i];
	}

	cout << ans << "\n";
	return;
}

int main()
{
	fastIO;
	int mt = 1;
	//cin >> mt;
	while(mt--) {
		solve();
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Incorrect 2 ms 7156 KB Output isn't correct
4 Incorrect 5 ms 10844 KB Output isn't correct
5 Incorrect 39 ms 20572 KB Output isn't correct
6 Incorrect 343 ms 61408 KB Output isn't correct
7 Incorrect 900 ms 99776 KB Output isn't correct
8 Incorrect 1664 ms 153652 KB Output isn't correct
9 Runtime error 971 ms 262144 KB Execution killed with signal 9
10 Runtime error 1081 ms 262144 KB Execution killed with signal 9
11 Runtime error 1353 ms 262144 KB Execution killed with signal 9
12 Runtime error 1138 ms 262144 KB Execution killed with signal 9
13 Runtime error 1171 ms 262144 KB Execution killed with signal 9
14 Runtime error 1298 ms 262144 KB Execution killed with signal 9
15 Runtime error 1251 ms 262144 KB Execution killed with signal 9
16 Runtime error 1174 ms 262144 KB Execution killed with signal 9
17 Runtime error 1222 ms 262144 KB Execution killed with signal 9
18 Runtime error 1230 ms 262144 KB Execution killed with signal 9
19 Runtime error 1183 ms 262144 KB Execution killed with signal 9
20 Runtime error 1130 ms 262144 KB Execution killed with signal 9