Submission #121034

# Submission time Handle Problem Language Result Execution time Memory
121034 2019-06-26T03:44:51 Z 윤교준(#2970) Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
162 ms 88604 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const int MAXH = 3005;
const int MAXW = 3005;

int CO[MAXH][MAXW], CI[MAXH][MAXW];
char A[MAXH][MAXW];

ll Ans;
int H, W;

int main() {
	scanf("%d%d", &H, &W);
	for(int i = 1; i <= H; i++) scanf(" %s", A[i]+1);
	for(int i = 1; i <= H; i++) for(int j = W; j; j--)
		CO[i][j] = CO[i][j+1] + ('O' == A[i][j]);
	for(int i = H; i; i--) for(int j = 1; j <= W; j++)
		CI[i][j] = CI[i+1][j] + ('I' == A[i][j]);
	
	for(int i = 1; i <= H; i++) for(int j = 1; j <= W; j++)
		if('J' == A[i][j]) Ans += CI[i][j] * CO[i][j];

	cout << Ans << endl;
	return 0;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:15: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:16:35: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i = 1; i <= H; i++) scanf(" %s", A[i]+1);
                              ~~~~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 4 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 3 ms 512 KB Output is correct
5 Correct 4 ms 1536 KB Output is correct
6 Correct 3 ms 1456 KB Output is correct
7 Correct 3 ms 1536 KB Output is correct
8 Correct 3 ms 1536 KB Output is correct
9 Correct 3 ms 1536 KB Output is correct
10 Correct 3 ms 1408 KB Output is correct
11 Correct 2 ms 1536 KB Output is correct
12 Correct 3 ms 1536 KB Output is correct
13 Correct 3 ms 1408 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 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 3 ms 512 KB Output is correct
5 Correct 4 ms 1536 KB Output is correct
6 Correct 3 ms 1456 KB Output is correct
7 Correct 3 ms 1536 KB Output is correct
8 Correct 3 ms 1536 KB Output is correct
9 Correct 3 ms 1536 KB Output is correct
10 Correct 3 ms 1408 KB Output is correct
11 Correct 2 ms 1536 KB Output is correct
12 Correct 3 ms 1536 KB Output is correct
13 Correct 3 ms 1408 KB Output is correct
14 Correct 11 ms 7552 KB Output is correct
15 Correct 6 ms 4992 KB Output is correct
16 Correct 6 ms 4352 KB Output is correct
17 Correct 2 ms 512 KB Output is correct
18 Correct 10 ms 8064 KB Output is correct
19 Correct 10 ms 7936 KB Output is correct
20 Correct 9 ms 7936 KB Output is correct
21 Correct 10 ms 8064 KB Output is correct
22 Correct 10 ms 7936 KB Output is correct
23 Correct 9 ms 7936 KB Output is correct
24 Correct 11 ms 8064 KB Output is correct
25 Correct 9 ms 7920 KB Output is correct
26 Correct 9 ms 7936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 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 3 ms 512 KB Output is correct
5 Correct 4 ms 1536 KB Output is correct
6 Correct 3 ms 1456 KB Output is correct
7 Correct 3 ms 1536 KB Output is correct
8 Correct 3 ms 1536 KB Output is correct
9 Correct 3 ms 1536 KB Output is correct
10 Correct 3 ms 1408 KB Output is correct
11 Correct 2 ms 1536 KB Output is correct
12 Correct 3 ms 1536 KB Output is correct
13 Correct 3 ms 1408 KB Output is correct
14 Correct 11 ms 7552 KB Output is correct
15 Correct 6 ms 4992 KB Output is correct
16 Correct 6 ms 4352 KB Output is correct
17 Correct 2 ms 512 KB Output is correct
18 Correct 10 ms 8064 KB Output is correct
19 Correct 10 ms 7936 KB Output is correct
20 Correct 9 ms 7936 KB Output is correct
21 Correct 10 ms 8064 KB Output is correct
22 Correct 10 ms 7936 KB Output is correct
23 Correct 9 ms 7936 KB Output is correct
24 Correct 11 ms 8064 KB Output is correct
25 Correct 9 ms 7920 KB Output is correct
26 Correct 9 ms 7936 KB Output is correct
27 Correct 152 ms 88116 KB Output is correct
28 Correct 23 ms 26112 KB Output is correct
29 Correct 12 ms 7808 KB Output is correct
30 Correct 2 ms 640 KB Output is correct
31 Correct 116 ms 72568 KB Output is correct
32 Correct 129 ms 88568 KB Output is correct
33 Correct 119 ms 88156 KB Output is correct
34 Correct 135 ms 84188 KB Output is correct
35 Correct 127 ms 88412 KB Output is correct
36 Correct 123 ms 88196 KB Output is correct
37 Correct 162 ms 88604 KB Output is correct
38 Correct 101 ms 72524 KB Output is correct
39 Correct 95 ms 72292 KB Output is correct