Submission #121035

# Submission time Handle Problem Language Result Execution time Memory
121035 2019-06-26T03:46:19 Z 이온조(#2969) Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
570 ms 80020 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]);
    ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory 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 384 KB Output is correct
5 Correct 3 ms 1536 KB Output is correct
6 Correct 3 ms 1536 KB Output is correct
7 Correct 4 ms 1408 KB Output is correct
8 Correct 3 ms 1536 KB Output is correct
9 Correct 4 ms 1580 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 3 ms 1408 KB Output is correct
# Verdict Execution time Memory 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 384 KB Output is correct
5 Correct 3 ms 1536 KB Output is correct
6 Correct 3 ms 1536 KB Output is correct
7 Correct 4 ms 1408 KB Output is correct
8 Correct 3 ms 1536 KB Output is correct
9 Correct 4 ms 1580 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 3 ms 1408 KB Output is correct
14 Correct 17 ms 7296 KB Output is correct
15 Correct 6 ms 4992 KB Output is correct
16 Correct 11 ms 4224 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 21 ms 7808 KB Output is correct
19 Correct 20 ms 7680 KB Output is correct
20 Correct 19 ms 7808 KB Output is correct
21 Correct 21 ms 7800 KB Output is correct
22 Correct 19 ms 7680 KB Output is correct
23 Correct 19 ms 7680 KB Output is correct
24 Correct 21 ms 7780 KB Output is correct
25 Correct 19 ms 7672 KB Output is correct
26 Correct 19 ms 7680 KB Output is correct
# Verdict Execution time Memory 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 384 KB Output is correct
5 Correct 3 ms 1536 KB Output is correct
6 Correct 3 ms 1536 KB Output is correct
7 Correct 4 ms 1408 KB Output is correct
8 Correct 3 ms 1536 KB Output is correct
9 Correct 4 ms 1580 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 3 ms 1408 KB Output is correct
14 Correct 17 ms 7296 KB Output is correct
15 Correct 6 ms 4992 KB Output is correct
16 Correct 11 ms 4224 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 21 ms 7808 KB Output is correct
19 Correct 20 ms 7680 KB Output is correct
20 Correct 19 ms 7808 KB Output is correct
21 Correct 21 ms 7800 KB Output is correct
22 Correct 19 ms 7680 KB Output is correct
23 Correct 19 ms 7680 KB Output is correct
24 Correct 21 ms 7780 KB Output is correct
25 Correct 19 ms 7672 KB Output is correct
26 Correct 19 ms 7680 KB Output is correct
27 Correct 524 ms 80020 KB Output is correct
28 Correct 23 ms 26104 KB Output is correct
29 Correct 36 ms 7288 KB Output is correct
30 Correct 3 ms 640 KB Output is correct
31 Correct 391 ms 66816 KB Output is correct
32 Correct 493 ms 79860 KB Output is correct
33 Correct 457 ms 79620 KB Output is correct
34 Correct 464 ms 77232 KB Output is correct
35 Correct 497 ms 79944 KB Output is correct
36 Correct 478 ms 79656 KB Output is correct
37 Correct 570 ms 79836 KB Output is correct
38 Correct 349 ms 66604 KB Output is correct
39 Correct 344 ms 66396 KB Output is correct