답안 #121269

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
121269 2019-06-26T09:31:27 Z onjo0127 Bitaro the Brave (JOI19_ho_t1) C++11
100 / 100
558 ms 85704 KB
#include <bits/stdc++.h>
using namespace std;

char A[3009][3009];
int O[3009][3009], I[3009][3009];

int main() {
	int H, W; scanf("%d%d",&H,&W);
	for(int i=1; i<=H; i++) {
		for(int j=1; j<=W; j++) {
			scanf(" %c", &A[i][j]);
			O[i][j] = O[i][j-1];
			I[i][j] = I[i-1][j];
			if(A[i][j] == 'O') ++O[i][j];
			if(A[i][j] == 'I') ++I[i][j];
		}
	}
	long long ans = 0;
	for(int i=1; i<=H; i++) {
		for(int j=1; j<=W; j++) {
			if(A[i][j] == 'J') ans += 1LL * (O[i][W] - O[i][j]) * (I[H][j] - I[i][j]);
		}
	}
	printf("%lld", ans);
	return 0;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:8:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  int H, W; scanf("%d%d",&H,&W);
            ~~~~~^~~~~~~~~~~~~~
joi2019_ho_t1.cpp:11:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf(" %c", &A[i][j]);
    ~~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 3 ms 1536 KB Output is correct
6 Correct 3 ms 1536 KB Output is correct
7 Correct 3 ms 1408 KB Output is correct
8 Correct 4 ms 1536 KB Output is correct
9 Correct 3 ms 1536 KB Output is correct
10 Correct 4 ms 1408 KB Output is correct
11 Correct 3 ms 1536 KB Output is correct
12 Correct 3 ms 1408 KB Output is correct
13 Correct 4 ms 1408 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 3 ms 1536 KB Output is correct
6 Correct 3 ms 1536 KB Output is correct
7 Correct 3 ms 1408 KB Output is correct
8 Correct 4 ms 1536 KB Output is correct
9 Correct 3 ms 1536 KB Output is correct
10 Correct 4 ms 1408 KB Output is correct
11 Correct 3 ms 1536 KB Output is correct
12 Correct 3 ms 1408 KB Output is correct
13 Correct 4 ms 1408 KB Output is correct
14 Correct 19 ms 7480 KB Output is correct
15 Correct 6 ms 4992 KB Output is correct
16 Correct 11 ms 4352 KB Output is correct
17 Correct 3 ms 512 KB Output is correct
18 Correct 27 ms 8056 KB Output is correct
19 Correct 19 ms 7936 KB Output is correct
20 Correct 19 ms 7936 KB Output is correct
21 Correct 23 ms 7928 KB Output is correct
22 Correct 21 ms 7928 KB Output is correct
23 Correct 21 ms 7868 KB Output is correct
24 Correct 22 ms 8064 KB Output is correct
25 Correct 20 ms 7932 KB Output is correct
26 Correct 19 ms 7936 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 3 ms 1536 KB Output is correct
6 Correct 3 ms 1536 KB Output is correct
7 Correct 3 ms 1408 KB Output is correct
8 Correct 4 ms 1536 KB Output is correct
9 Correct 3 ms 1536 KB Output is correct
10 Correct 4 ms 1408 KB Output is correct
11 Correct 3 ms 1536 KB Output is correct
12 Correct 3 ms 1408 KB Output is correct
13 Correct 4 ms 1408 KB Output is correct
14 Correct 19 ms 7480 KB Output is correct
15 Correct 6 ms 4992 KB Output is correct
16 Correct 11 ms 4352 KB Output is correct
17 Correct 3 ms 512 KB Output is correct
18 Correct 27 ms 8056 KB Output is correct
19 Correct 19 ms 7936 KB Output is correct
20 Correct 19 ms 7936 KB Output is correct
21 Correct 23 ms 7928 KB Output is correct
22 Correct 21 ms 7928 KB Output is correct
23 Correct 21 ms 7868 KB Output is correct
24 Correct 22 ms 8064 KB Output is correct
25 Correct 20 ms 7932 KB Output is correct
26 Correct 19 ms 7936 KB Output is correct
27 Correct 538 ms 85616 KB Output is correct
28 Correct 34 ms 26104 KB Output is correct
29 Correct 46 ms 7772 KB Output is correct
30 Correct 3 ms 640 KB Output is correct
31 Correct 410 ms 72252 KB Output is correct
32 Correct 547 ms 85380 KB Output is correct
33 Correct 495 ms 85188 KB Output is correct
34 Correct 488 ms 82920 KB Output is correct
35 Correct 542 ms 85368 KB Output is correct
36 Correct 480 ms 85200 KB Output is correct
37 Correct 558 ms 85704 KB Output is correct
38 Correct 359 ms 72432 KB Output is correct
39 Correct 340 ms 72120 KB Output is correct