Submission #678781

# Submission time Handle Problem Language Result Execution time Memory
678781 2023-01-06T14:52:47 Z hello_there_123 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
624 ms 159172 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
main(){
	int n,m;
	cin>>n>>m;
	char arr[n+3][m+3];
	int O[n+3][m+3];
	int I[n+3][m+3];
	memset(O,0,sizeof(O));
	memset(I,0,sizeof(I));
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cin>>arr[i][j];
		}
	}
	for(int i=0;i<n;i++){
		for(int j=m-1;j>=0;j--){
			if(arr[i][j]!='O'){
				O[i][j] = O[i][j+1];
				continue;
			}
			if(j==m-1) O[i][j] = 1;
			else O[i][j] = O[i][j+1]+1;
		}
	}
	for(int i=n-1;i>=0;i--){
		for(int j=0;j<m;j++){
			if(arr[i][j]!='I'){
				I[i][j] = I[i+1][j];
				continue;
			}
			if(i==n-1) I[i][j] = 1;
			else I[i][j] = I[i+1][j]+1;
		}
	}
	int sum = 0;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			if(arr[i][j] == 'J'){
				sum+=O[i][j]*I[i][j];
			}
		}
	}
	cout<<sum;
}

Compilation message

joi2019_ho_t1.cpp:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 308 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 468 KB Output is correct
9 Correct 1 ms 468 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
11 Correct 1 ms 468 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 308 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 468 KB Output is correct
9 Correct 1 ms 468 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
11 Correct 1 ms 468 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 468 KB Output is correct
14 Correct 14 ms 3668 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 9 ms 2612 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 18 ms 4692 KB Output is correct
19 Correct 16 ms 4564 KB Output is correct
20 Correct 16 ms 4564 KB Output is correct
21 Correct 18 ms 4752 KB Output is correct
22 Correct 16 ms 4572 KB Output is correct
23 Correct 16 ms 4564 KB Output is correct
24 Correct 19 ms 4692 KB Output is correct
25 Correct 16 ms 4440 KB Output is correct
26 Correct 15 ms 4564 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 308 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 468 KB Output is correct
8 Correct 1 ms 468 KB Output is correct
9 Correct 1 ms 468 KB Output is correct
10 Correct 1 ms 468 KB Output is correct
11 Correct 1 ms 468 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 468 KB Output is correct
14 Correct 14 ms 3668 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 9 ms 2612 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 18 ms 4692 KB Output is correct
19 Correct 16 ms 4564 KB Output is correct
20 Correct 16 ms 4564 KB Output is correct
21 Correct 18 ms 4752 KB Output is correct
22 Correct 16 ms 4572 KB Output is correct
23 Correct 16 ms 4564 KB Output is correct
24 Correct 19 ms 4692 KB Output is correct
25 Correct 16 ms 4440 KB Output is correct
26 Correct 15 ms 4564 KB Output is correct
27 Correct 596 ms 150244 KB Output is correct
28 Correct 2 ms 828 KB Output is correct
29 Correct 44 ms 11812 KB Output is correct
30 Correct 2 ms 812 KB Output is correct
31 Correct 436 ms 110476 KB Output is correct
32 Correct 574 ms 157972 KB Output is correct
33 Correct 570 ms 158452 KB Output is correct
34 Correct 503 ms 128204 KB Output is correct
35 Correct 571 ms 158012 KB Output is correct
36 Correct 566 ms 158516 KB Output is correct
37 Correct 624 ms 159172 KB Output is correct
38 Correct 406 ms 109628 KB Output is correct
39 Correct 395 ms 110068 KB Output is correct