답안 #88658

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
88658 2018-12-07T09:20:59 Z Badral 힘 센 거북 (IZhO11_turtle) C++17
10 / 100
832 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++;
		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 6 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Runtime error 781 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Runtime error 766 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
5 Runtime error 812 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
6 Runtime error 832 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
7 Runtime error 767 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
8 Runtime error 763 ms 262144 KB Execution killed with signal 9 (could be triggered by violating memory limits)
9 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 3 ms 376 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 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Runtime error 3 ms 376 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 2 ms 372 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 0 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 1 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 2 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)