답안 #88618

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
88618 2018-12-07T05:31:37 Z turbat 힘 센 거북 (IZhO11_turtle) C++14
40 / 100
2000 ms 243320 KB
#include <bits/stdc++.h> 
using namespace std; 
 
int n, m, k, t, z, a, b, d[1010][1010][30], ans;
bool u[2002][2002];
 
int main (){
	cin >> n>> m>> k>> t>> z;
	for (int i = 0;i < k;i++){
		cin >> a>> b;
		u[a + 1][b + 1] = 1;
	}
	d[n + 2][m + 2][t + 1];
	for (int i = 0; i < n + 2;i++)
		for (int j = 0;j < m + 2;j++)
			for (int o = 0;o <= t;o++)
				d[i][j][o] = 0;

	d[1][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[i][j][o] = (d[i][j][o] + d[i - 1][j][o - 1] + d[i][j - 1][o - 1]) % z;
				if (!u[i][j]) d[i][j][o] = (d[i][j][o] + d[i - 1][j][o] + d[i][j - 1][o]) % z;
			}
		}
	for (int i = 0;i <= t;i++)
		ans = (ans + d[n + 1][m + 1][i]) % z;
	cout << ans;
}

Compilation message

turtle.cpp: In function 'int main()':
turtle.cpp:13:23: warning: statement has no effect [-Wunused-value]
  d[n + 2][m + 2][t + 1];
  ~~~~~~~~~~~~~~~~~~~~~^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 760 KB Output is correct
4 Correct 3 ms 1272 KB Output is correct
5 Correct 9 ms 4600 KB Output is correct
6 Correct 37 ms 31992 KB Output is correct
7 Correct 68 ms 50936 KB Output is correct
8 Correct 160 ms 119160 KB Output is correct
9 Runtime error 288 ms 243320 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 321 ms 243124 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 1391 ms 243152 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Execution timed out 2053 ms 70836 KB Time limit exceeded
13 Execution timed out 2087 ms 76616 KB Time limit exceeded
14 Runtime error 1215 ms 243204 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 1755 ms 243124 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Execution timed out 2070 ms 80988 KB Time limit exceeded
17 Execution timed out 2082 ms 83652 KB Time limit exceeded
18 Execution timed out 2108 ms 73916 KB Time limit exceeded
19 Execution timed out 2049 ms 75172 KB Time limit exceeded
20 Execution timed out 2013 ms 72944 KB Time limit exceeded