Submission #991023

# Submission time Handle Problem Language Result Execution time Memory
991023 2024-06-01T04:46:30 Z Muhammet Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
168 ms 159316 KB
#include <bits/stdc++.h>
using namespace std;

#define N 3005
#define ll long long int
#define sz(x) (int)x.size()
#define ff first
#define ss second

ll T, n, a[N][N], b[N][N], m;

string s[N];

int main(){
	ios::sync_with_stdio(false); cin.tie(0);

	cin >> n >> m;
	for(int i = 1; i <= n; i++){
		cin >> s[i];
		s[i] = '#' + s[i];
	}
	for(int i = 1; i <= n; i++){
		for(int j = m; j >= 1; j--){
			a[i][j] = a[i][j+1];
			if(s[i][j] == 'O') a[i][j]++;
		}
	}
	for(int i = 1; i <= m; i++){
		for(int j = n; j >= 1; j--){
			b[j][i] = b[j+1][i];
			if(s[j][i] == 'I') b[j][i]++;
		}
	}
	ll ans = 0;
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= m; j++){
			if(s[i][j] == 'J') ans += (b[i][j] * a[i][j]);
		}
	}
	cout << ans << '\n';

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 1 ms 3164 KB Output is correct
6 Correct 1 ms 3160 KB Output is correct
7 Correct 1 ms 2904 KB Output is correct
8 Correct 1 ms 3164 KB Output is correct
9 Correct 1 ms 2908 KB Output is correct
10 Correct 1 ms 2908 KB Output is correct
11 Correct 1 ms 3164 KB Output is correct
12 Correct 1 ms 2908 KB Output is correct
13 Correct 1 ms 2908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 1 ms 3164 KB Output is correct
6 Correct 1 ms 3160 KB Output is correct
7 Correct 1 ms 2904 KB Output is correct
8 Correct 1 ms 3164 KB Output is correct
9 Correct 1 ms 2908 KB Output is correct
10 Correct 1 ms 2908 KB Output is correct
11 Correct 1 ms 3164 KB Output is correct
12 Correct 1 ms 2908 KB Output is correct
13 Correct 1 ms 2908 KB Output is correct
14 Correct 5 ms 14940 KB Output is correct
15 Correct 3 ms 10844 KB Output is correct
16 Correct 3 ms 7660 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
18 Correct 7 ms 15620 KB Output is correct
19 Correct 5 ms 15644 KB Output is correct
20 Correct 5 ms 15508 KB Output is correct
21 Correct 10 ms 15640 KB Output is correct
22 Correct 7 ms 15708 KB Output is correct
23 Correct 5 ms 15452 KB Output is correct
24 Correct 7 ms 15616 KB Output is correct
25 Correct 5 ms 15708 KB Output is correct
26 Correct 5 ms 15452 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 1 ms 3164 KB Output is correct
6 Correct 1 ms 3160 KB Output is correct
7 Correct 1 ms 2904 KB Output is correct
8 Correct 1 ms 3164 KB Output is correct
9 Correct 1 ms 2908 KB Output is correct
10 Correct 1 ms 2908 KB Output is correct
11 Correct 1 ms 3164 KB Output is correct
12 Correct 1 ms 2908 KB Output is correct
13 Correct 1 ms 2908 KB Output is correct
14 Correct 5 ms 14940 KB Output is correct
15 Correct 3 ms 10844 KB Output is correct
16 Correct 3 ms 7660 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
18 Correct 7 ms 15620 KB Output is correct
19 Correct 5 ms 15644 KB Output is correct
20 Correct 5 ms 15508 KB Output is correct
21 Correct 10 ms 15640 KB Output is correct
22 Correct 7 ms 15708 KB Output is correct
23 Correct 5 ms 15452 KB Output is correct
24 Correct 7 ms 15616 KB Output is correct
25 Correct 5 ms 15708 KB Output is correct
26 Correct 5 ms 15452 KB Output is correct
27 Correct 154 ms 158292 KB Output is correct
28 Correct 11 ms 63580 KB Output is correct
29 Correct 7 ms 14004 KB Output is correct
30 Correct 1 ms 860 KB Output is correct
31 Correct 111 ms 130396 KB Output is correct
32 Correct 116 ms 159052 KB Output is correct
33 Correct 109 ms 158808 KB Output is correct
34 Correct 142 ms 151216 KB Output is correct
35 Correct 116 ms 159056 KB Output is correct
36 Correct 103 ms 158800 KB Output is correct
37 Correct 168 ms 159316 KB Output is correct
38 Correct 83 ms 129828 KB Output is correct
39 Correct 81 ms 129876 KB Output is correct