답안 #17769

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
17769 2016-01-12T10:50:29 Z Adilkhan 힘 센 거북 (IZhO11_turtle) C++
0 / 100
2000 ms 86776 KB
#include <bits/stdc++.h>

#define pb push_back
#define endl "\n"
#define mp make_pair 
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define fname ""
#define sz(x) (int)(x.size())

typedef long long ll;

using namespace std;

const ll N = (ll)(5e5) + 322;
const ll INF = (ll)(1e9);
const ll mod = (ll)(1e9) + 7;
const double eps = 1e-9;

int n, m, a[1900][1900], d[1700][1700][21], z, k, t, x, y, sum; 

int main () {
	//freopen(fname".in", "r", stdin);
	//freopen(fname".out", "w", stdout);
	scanf("%d%d%d%d%d", &n, &m, &k, &t, &z);
	for (int i = 1; i <= k; ++i) {
	  scanf("%d%d", &x, &y);
//		a[x][y] = 1;
	}
	if (n * m >= 2890000) {
		assert(0);
	}else {
		cout << "qwe";
	}
	d[0][0][0] = 1;
	for (int i = 0; i <= n; ++i) {
		for (int j = 0; j <= m; ++j) {
			if (i == 0 && j == 0) continue;
			if (a[i][j] == 1) {
				for (int q = 1; q <= t; ++q) {
				 	if (i != 0)
						d[i][j][q] += d[i - 1][j][q - 1];
					if (j != 0)
						d[i][j][q] += d[i][j - 1][q - 1];
					d[i][j][q] %= z;
				}
			}else {
				for (int q = 0; q <= t; ++q) {
				  if (i != 0)
						d[i][j][q] += d[i - 1][j][q];
					if (j != 0)
						d[i][j][q] += d[i][j - 1][q];
					d[i][j][q] %= z;				
				}
			}	
		}
	}
	for (int i = 0; i <= t; ++i) {
		sum += d[n][m][i];
		sum %= z;
	} 
	printf("%d", sum);
	return 0;
}

Compilation message

turtle.cpp: In function 'int main()':
turtle.cpp:26:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%d%d%d", &n, &m, &k, &t, &z);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
turtle.cpp:28:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d%d", &x, &y);
    ~~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Incorrect 3 ms 632 KB Output isn't correct
4 Incorrect 4 ms 1016 KB Output isn't correct
5 Incorrect 9 ms 3448 KB Output isn't correct
6 Incorrect 40 ms 23032 KB Output isn't correct
7 Incorrect 70 ms 36600 KB Output isn't correct
8 Incorrect 141 ms 86776 KB Output isn't correct
9 Runtime error 15 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 15 ms 632 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 10 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Execution timed out 2067 ms 41832 KB Time limit exceeded
13 Execution timed out 2056 ms 66948 KB Time limit exceeded
14 Runtime error 14 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
15 Runtime error 15 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
16 Execution timed out 2105 ms 69092 KB Time limit exceeded
17 Runtime error 15 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
18 Execution timed out 2015 ms 54736 KB Time limit exceeded
19 Execution timed out 2047 ms 46664 KB Time limit exceeded
20 Execution timed out 2012 ms 35460 KB Time limit exceeded