Submission #121042

# Submission time Handle Problem Language Result Execution time Memory
121042 2019-06-26T03:47:47 Z 임유진(#2971) Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
337 ms 80792 KB
#include<stdio.h>

#define MAXN 3005

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

int main(){
	int H, W;
	long long ans=0;

	scanf("%d%d", &H, &W);
	for(int i=0; i<H; i++) scanf("%s", A[i]);

	for(int i=0; i<H; i++) for(int j=W-1; j>=0; j--) O[i][j]=O[i][j+1]+(A[i][j]=='O'?1:0);
	for(int j=0; j<W; j++) for(int i=H-1; i>=0; i--) I[i][j]=I[i+1][j]+(A[i][j]=='I'?1:0);

	for(int i=0; i<H; i++) for(int j=0; j<W; j++) if(A[i][j]=='J') ans+=(long long)O[i][j]*I[i][j];

	printf("%lld", ans);
	return 0;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &H, &W);
  ~~~~~^~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:13:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=0; i<H; i++) scanf("%s", A[i]);
                         ~~~~~^~~~~~~~~~~~
# 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 356 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 1408 KB Output is correct
6 Correct 3 ms 1536 KB Output is correct
7 Correct 2 ms 1408 KB Output is correct
8 Correct 3 ms 1536 KB Output is correct
9 Correct 2 ms 1408 KB Output is correct
10 Correct 2 ms 1408 KB Output is correct
11 Correct 2 ms 1536 KB Output is correct
12 Correct 2 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 356 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 1408 KB Output is correct
6 Correct 3 ms 1536 KB Output is correct
7 Correct 2 ms 1408 KB Output is correct
8 Correct 3 ms 1536 KB Output is correct
9 Correct 2 ms 1408 KB Output is correct
10 Correct 2 ms 1408 KB Output is correct
11 Correct 2 ms 1536 KB Output is correct
12 Correct 2 ms 1408 KB Output is correct
13 Correct 3 ms 1408 KB Output is correct
14 Correct 10 ms 7424 KB Output is correct
15 Correct 6 ms 4992 KB Output is correct
16 Correct 5 ms 4224 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 11 ms 7936 KB Output is correct
19 Correct 10 ms 7936 KB Output is correct
20 Correct 10 ms 7808 KB Output is correct
21 Correct 11 ms 7936 KB Output is correct
22 Correct 10 ms 7936 KB Output is correct
23 Correct 9 ms 7808 KB Output is correct
24 Correct 11 ms 7936 KB Output is correct
25 Correct 10 ms 7944 KB Output is correct
26 Correct 11 ms 7800 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 356 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 1408 KB Output is correct
6 Correct 3 ms 1536 KB Output is correct
7 Correct 2 ms 1408 KB Output is correct
8 Correct 3 ms 1536 KB Output is correct
9 Correct 2 ms 1408 KB Output is correct
10 Correct 2 ms 1408 KB Output is correct
11 Correct 2 ms 1536 KB Output is correct
12 Correct 2 ms 1408 KB Output is correct
13 Correct 3 ms 1408 KB Output is correct
14 Correct 10 ms 7424 KB Output is correct
15 Correct 6 ms 4992 KB Output is correct
16 Correct 5 ms 4224 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 11 ms 7936 KB Output is correct
19 Correct 10 ms 7936 KB Output is correct
20 Correct 10 ms 7808 KB Output is correct
21 Correct 11 ms 7936 KB Output is correct
22 Correct 10 ms 7936 KB Output is correct
23 Correct 9 ms 7808 KB Output is correct
24 Correct 11 ms 7936 KB Output is correct
25 Correct 10 ms 7944 KB Output is correct
26 Correct 11 ms 7800 KB Output is correct
27 Correct 337 ms 80792 KB Output is correct
28 Correct 23 ms 25984 KB Output is correct
29 Correct 13 ms 7808 KB Output is correct
30 Correct 2 ms 512 KB Output is correct
31 Correct 241 ms 67564 KB Output is correct
32 Correct 310 ms 80668 KB Output is correct
33 Correct 295 ms 80512 KB Output is correct
34 Correct 275 ms 78156 KB Output is correct
35 Correct 298 ms 80560 KB Output is correct
36 Correct 297 ms 79736 KB Output is correct
37 Correct 336 ms 79820 KB Output is correct
38 Correct 221 ms 66548 KB Output is correct
39 Correct 222 ms 66232 KB Output is correct