# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
874972 | SevakYegoryan | Energetic turtle (IZhO11_turtle) | C++17 | 1664 ms | 262144 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|---|---|---|---|
Fetching results... |