Submission #913485

# Submission time Handle Problem Language Result Execution time Memory
913485 2024-01-20T08:06:24 Z prefixorsuuffiixx Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
246 ms 150708 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long

const int maxx = 3010;

int shemsh[maxx][maxx] , goi[maxx][maxx] , javaher[maxx][maxx];
char s[maxx][maxx];

signed main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int n , m;
	cin>>n>>m;
	for(int i = 1 ; i <= n ; i++){
		for(int j = 1 ; j <= m ; j++){
			cin>>s[i][j];
		}
	}
	for(int j = 1 ; j <= m ; j++){
		for(int i = n ; i >= 1 ; i--){
			javaher[i][j] = javaher[i+1][j];
			if(s[i][j] == 'I')javaher[i][j]++;
		}
	}

	for(int i = 1 ; i <= n ; i++){
		for(int j = m ;j >= 1 ; j--){
			shemsh[i][j] = shemsh[i][j+1];
			if(s[i][j] == 'O')shemsh[i][j]++;
		}
	}
	int ans = 0;
	for(int i = 1 ; i <= n ; i++){
		for(int j = 1 ; j <= m ; j++){
			if(s[i][j] == 'J'){
				ans+=shemsh[i][j] * javaher[i][j];
			}
		}
	}
	
	cout<<ans;
		
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 2 ms 5212 KB Output is correct
6 Correct 2 ms 5212 KB Output is correct
7 Correct 1 ms 5212 KB Output is correct
8 Correct 2 ms 5212 KB Output is correct
9 Correct 2 ms 5212 KB Output is correct
10 Correct 2 ms 5212 KB Output is correct
11 Correct 2 ms 5368 KB Output is correct
12 Correct 2 ms 5208 KB Output is correct
13 Correct 2 ms 5212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 2 ms 5212 KB Output is correct
6 Correct 2 ms 5212 KB Output is correct
7 Correct 1 ms 5212 KB Output is correct
8 Correct 2 ms 5212 KB Output is correct
9 Correct 2 ms 5212 KB Output is correct
10 Correct 2 ms 5212 KB Output is correct
11 Correct 2 ms 5368 KB Output is correct
12 Correct 2 ms 5208 KB Output is correct
13 Correct 2 ms 5212 KB Output is correct
14 Correct 8 ms 16988 KB Output is correct
15 Correct 4 ms 14680 KB Output is correct
16 Correct 6 ms 10844 KB Output is correct
17 Correct 1 ms 600 KB Output is correct
18 Correct 9 ms 17500 KB Output is correct
19 Correct 9 ms 17500 KB Output is correct
20 Correct 8 ms 17244 KB Output is correct
21 Correct 11 ms 17500 KB Output is correct
22 Correct 9 ms 17500 KB Output is correct
23 Correct 9 ms 17252 KB Output is correct
24 Correct 10 ms 17496 KB Output is correct
25 Correct 9 ms 17340 KB Output is correct
26 Correct 8 ms 17360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 2 ms 5212 KB Output is correct
6 Correct 2 ms 5212 KB Output is correct
7 Correct 1 ms 5212 KB Output is correct
8 Correct 2 ms 5212 KB Output is correct
9 Correct 2 ms 5212 KB Output is correct
10 Correct 2 ms 5212 KB Output is correct
11 Correct 2 ms 5368 KB Output is correct
12 Correct 2 ms 5208 KB Output is correct
13 Correct 2 ms 5212 KB Output is correct
14 Correct 8 ms 16988 KB Output is correct
15 Correct 4 ms 14680 KB Output is correct
16 Correct 6 ms 10844 KB Output is correct
17 Correct 1 ms 600 KB Output is correct
18 Correct 9 ms 17500 KB Output is correct
19 Correct 9 ms 17500 KB Output is correct
20 Correct 8 ms 17244 KB Output is correct
21 Correct 11 ms 17500 KB Output is correct
22 Correct 9 ms 17500 KB Output is correct
23 Correct 9 ms 17252 KB Output is correct
24 Correct 10 ms 17496 KB Output is correct
25 Correct 9 ms 17340 KB Output is correct
26 Correct 8 ms 17360 KB Output is correct
27 Correct 243 ms 150708 KB Output is correct
28 Correct 17 ms 72180 KB Output is correct
29 Correct 16 ms 15196 KB Output is correct
30 Correct 2 ms 860 KB Output is correct
31 Correct 186 ms 126944 KB Output is correct
32 Correct 240 ms 150672 KB Output is correct
33 Correct 243 ms 150124 KB Output is correct
34 Correct 221 ms 145768 KB Output is correct
35 Correct 218 ms 150592 KB Output is correct
36 Correct 210 ms 150148 KB Output is correct
37 Correct 246 ms 150612 KB Output is correct
38 Correct 160 ms 126544 KB Output is correct
39 Correct 190 ms 126548 KB Output is correct