Submission #130441

# Submission time Handle Problem Language Result Execution time Memory
130441 2019-07-15T08:09:00 Z 임유진(#3151) Dominance (CEOI08_dominance) C++14
20 / 100
164 ms 65540 KB
#include <stdio.h>
#include <algorithm>

using namespace std;

#define MAXH 20005
#define MAXN 3005

char C[MAXN];
int A[MAXN], B[MAXN], R[MAXN];
int dp[MAXH][MAXH];

int main() {
	int H, W, N;

	scanf("%d%d%d", &H, &W, &N);
	for(int i = 0; i < N; i++) scanf("\n%c%d%d%d", C + i, A + i, B + i, R + i);

	//for(int i = 0; i < N; i++) printf("[%c]", C[i]);

	for(int i = 0; i < N; i++) {
		int z = C[i] == 'W' ? 1 : -1;
		for(int j = max(0, B[i] - R[i]); j < B[i]; j++) {
			dp[j][max(0, A[i] + B[i] - R[i] - j)] += z;
			dp[j][min(W, A[i] - B[i] + R[i] + j + 1)] -= z;
		}
		for(int j = B[i]; j < min(H, B[i] + R[i] + 1); j++) {
			dp[j][max(0, A[i] - B[i] - R[i] + j)] += z;
			dp[j][min(W, A[i] + B[i] + R[i] - j + 1)] -= z;
		}
	}

	int ansp = 0, ansm = 0;
	for(int i = 0; i < H; i++) for(int j = 0; j < W; j++) {
		if(j > 0) dp[i][j] += dp[i][j - 1];
		if(dp[i][j] > 0) ansp++;
		else if(dp[i][j] < 0) ansm++;
	}

	printf("%d %d", ansp, ansm);
	return 0;
}

Compilation message

dominance.cpp: In function 'int main()':
dominance.cpp:16:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%d", &H, &W, &N);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~
dominance.cpp:17:34: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i = 0; i < N; i++) scanf("\n%c%d%d%d", C + i, A + i, B + i, R + i);
                             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 632 KB Output is correct
2 Runtime error 62 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
3 Runtime error 85 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 87 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 90 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 85 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 60 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
8 Runtime error 86 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 87 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 87 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
11 Runtime error 86 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Runtime error 85 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
13 Runtime error 86 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
14 Correct 3 ms 1912 KB Output is correct
15 Runtime error 164 ms 65540 KB Execution killed with signal 9 (could be triggered by violating memory limits)
16 Correct 14 ms 8312 KB Output is correct
17 Correct 12 ms 8440 KB Output is correct
18 Runtime error 85 ms 376 KB Execution killed with signal 11 (could be triggered by violating memory limits)
19 Incorrect 3 ms 1272 KB Output isn't correct
20 Incorrect 25 ms 20344 KB Output isn't correct