Submission #88655

# Submission time Handle Problem Language Result Execution time Memory
88655 2018-12-07T09:18:01 Z Badral Energetic turtle (IZhO11_turtle) C++17
10 / 100
802 ms 262148 KB
#include<bits/stdc++.h>
#define maxn 1005
#define mp make_pair
using namespace std;
typedef long long ll;

bool a[maxn][maxn];

int main() {
	int n, m, k1, t, z;
	cin >>n >>m >>k1 >>t >>z;
	while(k1--) {
		int x, y;
		cin >>x >>y;
		a[x][y] = 1;
	}
	ll ans = 0;
	queue<pair<pair<int,int> ,int> > pq;
	pq.push(mp(mp(0, 0), t));
	while(!pq.empty()) {
		int x = pq.front().first.first;
		int y = pq.front().first.second;
		int k = pq.front().second;
		if(x == n && y == m) ans++;
	
		if(x < n) {
			if(a[x+1][y] == 1 && k > 0) {
				pq.push(mp(mp(x+1, y), k-1));
			}
			if(a[x+1][y] == 0) {
				pq.push(mp(mp(x+1, y), k));
			}
		}
		if(y < m) {
			if(a[x][y+1] == 1 && k > 0) {
				pq.push(mp(mp(x, y+1), k-1));
			}
			if(a[x][y+1] == 0) {
				pq.push(mp(mp(x, y+1), k));
			}
		}
		pq.pop();
	}
	cout<<ans;

}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Runtime error 802 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Runtime error 796 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
5 Runtime error 775 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
6 Runtime error 769 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
7 Runtime error 784 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
8 Runtime error 796 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
9 Runtime error 2 ms 380 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 3 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 2 ms 380 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 2 ms 380 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 9 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 5 ms 508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 3 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)