답안 #88656

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
88656 2018-12-07T09:18:29 Z Badral 힘 센 거북 (IZhO11_turtle) C++17
10 / 100
831 ms 262148 KB
#include<bits/stdc++.h>
#define maxn 10005
#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;

}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Runtime error 761 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Runtime error 773 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
5 Runtime error 764 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
6 Runtime error 831 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
7 Runtime error 797 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
8 Runtime error 773 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
9 Runtime error 776 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
10 Runtime error 768 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
11 Runtime error 7 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 7 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 5 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 16 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 4 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 7 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 7 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 14 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 8 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 8 ms 404 KB Execution killed with signal 11 (could be triggered by violating memory limits)