답안 #88662

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
88662 2018-12-07T09:34:36 Z turbat 힘 센 거북 (IZhO11_turtle) C++14
40 / 100
55 ms 632 KB
#include <bits/stdc++.h> 
using namespace std; 
int n, m, k, t, z, a, b, ans, d[5][1005][22];
bool u[2002][2002];
int main (){
	cin >> n>> m>> k>> t>> z;
	while(k--){
		cin >> a>> b;
		u[a + 1][b + 1] = 1;
	}
	d[2][1][0] = 1;
	for (int i = 1; i <= n + 1;i++){
		for (int j = 1;j <= m + 1;j++)
				for (int o = 0;o <= t;o++){
					if (u[i][j] && o) d[2][j][o] = (d[2][j][o] + d[1][j][o - 1] + d[2][j - 1][o - 1]) % z;
					if (!u[i][j]) d[2][j][o] = (d[2][j][o] + d[1][j][o] + d[2][j - 1][o]) % z;
				}
		for (int l = 1;l <= 2;l++)
			for (int j = 1;j <= m + 1;j++)
				for (int o = 0;o <= t;o++)
					d[l][j][o] = d[l + 1][j][o];
	}
	for (int i = 0;i <= t;i++)
		ans = (ans + d[1][m + 1][i]) % z;
	cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 0 ms 376 KB Output is correct
5 Correct 6 ms 420 KB Output is correct
6 Correct 13 ms 504 KB Output is correct
7 Correct 31 ms 632 KB Output is correct
8 Correct 55 ms 504 KB Output is correct
9 Runtime error 4 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 3 ms 504 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 4 ms 504 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 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 3 ms 380 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Runtime error 3 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Runtime error 3 ms 508 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Runtime error 2 ms 476 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
20 Runtime error 8 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)