# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
88669 | Badral | Energetic turtle (IZhO11_turtle) | C++17 | 544 ms | 262148 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.
#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;
int ans;
bool a[maxn][maxn];
vector<int> v[maxn][maxn];
int n, m, k1, t, z;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >>n >>m >>k1 >>t >>z;
while(k1--) {
int x, y;
cin >>x >>y;
a[x][y] = 1;
}
v[0][0].pb(t);
for(int i = 0; i <= n; i++) {
for(int j = 0; j <= m; j++) {
if(i > 0) {
for(int o = 0; o < v[i-1][j].size(); o++) {
if(a[i][j] == 1 && v[i-1][j][o] > 0) {
v[i][j].pb(v[i-1][j][o]-1);
}
if(a[i][j] == 0) {
v[i][j].pb(v[i-1][j][o]);
}
}
}
if(j > 0) {
for(int o = 0; o < v[i][j-1].size(); o++) {
if(a[i][j] == 1 && v[i][j-1][o] > 0) {
v[i][j].pb(v[i][j-1][o]-1);
}
if(a[i][j] == 0) {
v[i][j].pb(v[i][j-1][o]);
}
}
}
}
}
cout<<v[n][m].size()%z;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |