Submission #945332

# Submission time Handle Problem Language Result Execution time Memory
945332 2024-03-13T16:08:41 Z vako_p Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
263 ms 159184 KB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long

const int mxN = 3e3 + 5;
ll n,cntl[mxN][mxN],cntk[mxN][mxN],m,ans;
char ch[mxN][mxN];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);   
	cin >> n >> m;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			cin >> ch[i][j];
		}
	}
	for(int i = 0; i < n; i++){
		for(int j = m - 1; j >= 0; j--){
			cntl[i][j] = cntl[i][j + 1] + (ch[i][j] == 'O');		
		}
	}
	for(int j = 0; j < m; j++){
		for(int i = n - 1; i >= 0; i--){
			cntk[i][j] = cntk[i + 1][j] + (ch[i][j] == 'I');
		}
	}
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			if(ch[i][j] == 'J') ans += cntl[i][j] * cntk[i][j];
		}
	}
	cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 5328 KB Output is correct
6 Correct 1 ms 5212 KB Output is correct
7 Correct 1 ms 5212 KB Output is correct
8 Correct 1 ms 5212 KB Output is correct
9 Correct 1 ms 5208 KB Output is correct
10 Correct 1 ms 5212 KB Output is correct
11 Correct 1 ms 5212 KB Output is correct
12 Correct 1 ms 5212 KB Output is correct
13 Correct 2 ms 5212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 5328 KB Output is correct
6 Correct 1 ms 5212 KB Output is correct
7 Correct 1 ms 5212 KB Output is correct
8 Correct 1 ms 5212 KB Output is correct
9 Correct 1 ms 5208 KB Output is correct
10 Correct 1 ms 5212 KB Output is correct
11 Correct 1 ms 5212 KB Output is correct
12 Correct 1 ms 5212 KB Output is correct
13 Correct 2 ms 5212 KB Output is correct
14 Correct 8 ms 16988 KB Output is correct
15 Correct 3 ms 14684 KB Output is correct
16 Correct 4 ms 11100 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 9 ms 17752 KB Output is correct
19 Correct 7 ms 17500 KB Output is correct
20 Correct 8 ms 17512 KB Output is correct
21 Correct 9 ms 17756 KB Output is correct
22 Correct 7 ms 17500 KB Output is correct
23 Correct 8 ms 17500 KB Output is correct
24 Correct 10 ms 18044 KB Output is correct
25 Correct 8 ms 17500 KB Output is correct
26 Correct 9 ms 17448 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 5328 KB Output is correct
6 Correct 1 ms 5212 KB Output is correct
7 Correct 1 ms 5212 KB Output is correct
8 Correct 1 ms 5212 KB Output is correct
9 Correct 1 ms 5208 KB Output is correct
10 Correct 1 ms 5212 KB Output is correct
11 Correct 1 ms 5212 KB Output is correct
12 Correct 1 ms 5212 KB Output is correct
13 Correct 2 ms 5212 KB Output is correct
14 Correct 8 ms 16988 KB Output is correct
15 Correct 3 ms 14684 KB Output is correct
16 Correct 4 ms 11100 KB Output is correct
17 Correct 1 ms 2396 KB Output is correct
18 Correct 9 ms 17752 KB Output is correct
19 Correct 7 ms 17500 KB Output is correct
20 Correct 8 ms 17512 KB Output is correct
21 Correct 9 ms 17756 KB Output is correct
22 Correct 7 ms 17500 KB Output is correct
23 Correct 8 ms 17500 KB Output is correct
24 Correct 10 ms 18044 KB Output is correct
25 Correct 8 ms 17500 KB Output is correct
26 Correct 9 ms 17448 KB Output is correct
27 Correct 263 ms 158716 KB Output is correct
28 Correct 12 ms 72024 KB Output is correct
29 Correct 13 ms 15964 KB Output is correct
30 Correct 1 ms 2652 KB Output is correct
31 Correct 159 ms 132984 KB Output is correct
32 Correct 216 ms 159044 KB Output is correct
33 Correct 206 ms 158568 KB Output is correct
34 Correct 194 ms 152552 KB Output is correct
35 Correct 207 ms 159184 KB Output is correct
36 Correct 212 ms 158708 KB Output is correct
37 Correct 237 ms 159100 KB Output is correct
38 Correct 154 ms 132616 KB Output is correct
39 Correct 159 ms 132328 KB Output is correct