답안 #88657

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
88657 2018-12-07T09:20:10 Z Badral 힘 센 거북 (IZhO11_turtle) C++17
10 / 100
823 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++;
		pq.pop();
		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));
			}
		}
	}
	cout<<ans%z;

}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 256 KB Output is correct
2 Correct 3 ms 292 KB Output is correct
3 Runtime error 767 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Runtime error 762 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
5 Runtime error 763 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
6 Runtime error 753 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
7 Runtime error 789 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
8 Runtime error 823 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
9 Runtime error 788 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
10 Runtime error 781 ms 262148 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 8 ms 444 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 7 ms 452 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 7 ms 504 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 8 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 7 ms 476 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 7 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 12 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)