Submission #88669

# Submission time Handle Problem Language Result Execution time Memory
88669 2018-12-07T09:57:33 Z Badral Energetic turtle (IZhO11_turtle) C++17
10 / 100
544 ms 262148 KB
#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

turtle.cpp: In function 'int main()':
turtle.cpp:27:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int o = 0; o < v[i-1][j].size(); o++) {
                    ~~^~~~~~~~~~~~~~~~~~
turtle.cpp:37:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int o = 0; o < v[i][j-1].size(); o++) {
                    ~~^~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 25 ms 24056 KB Output is correct
2 Correct 25 ms 24056 KB Output is correct
3 Runtime error 443 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Runtime error 439 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
5 Runtime error 466 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
6 Runtime error 410 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
7 Runtime error 410 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
8 Runtime error 544 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
9 Runtime error 68 ms 48504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 63 ms 48504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 62 ms 48504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 55 ms 48504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 50 ms 48632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 54 ms 48544 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 54 ms 48496 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 54 ms 48524 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 53 ms 48520 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 54 ms 48456 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 65 ms 48608 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 62 ms 48612 KB Execution killed with signal 11 (could be triggered by violating memory limits)