답안 #734068

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
734068 2023-05-01T15:49:54 Z LCJLY Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
368 ms 159384 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long 
typedef pair<int,int>pii;

int32_t main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int r,c;
	cin >> r >> c;
	
	char arr[r+5][c+5];
	
	for(int x=1;x<=r;x++){
		for(int y=1;y<=c;y++){
			cin >> arr[x][y];
		}
	}
	
	//compute psum 
	int horizontal[r+5][c+5];
	
	memset(horizontal,0,sizeof(horizontal));
	
	for(int x=1;x<=r;x++){
		for(int y=c;y>=1;y--){
			horizontal[x][y]=horizontal[x][y+1]+(arr[x][y]=='O');
		}
	}
	
	int vertical[r+5][c+5];
	
	memset(vertical,0,sizeof(vertical));
	
	for(int x=1;x<=c;x++){
		for(int y=r;y>=1;y--){
			vertical[y][x]=vertical[y+1][x]+(arr[y][x]=='I');
		}
	}
	
	int counter=0;
	for(int x=1;x<=r;x++){
		for(int y=1;y<=c;y++){
			if(arr[x][y]=='J'){
				counter+=horizontal[x][y]*vertical[x][y];
			}
		}
	}
	cout << counter;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 228 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 468 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 468 KB Output is correct
13 Correct 1 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 228 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 468 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 468 KB Output is correct
13 Correct 1 ms 468 KB Output is correct
14 Correct 5 ms 3668 KB Output is correct
15 Correct 1 ms 320 KB Output is correct
16 Correct 4 ms 2644 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 8 ms 4692 KB Output is correct
19 Correct 6 ms 4552 KB Output is correct
20 Correct 7 ms 4684 KB Output is correct
21 Correct 7 ms 4780 KB Output is correct
22 Correct 7 ms 4556 KB Output is correct
23 Correct 7 ms 4636 KB Output is correct
24 Correct 8 ms 4692 KB Output is correct
25 Correct 7 ms 4564 KB Output is correct
26 Correct 7 ms 4644 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 228 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 468 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 468 KB Output is correct
13 Correct 1 ms 468 KB Output is correct
14 Correct 5 ms 3668 KB Output is correct
15 Correct 1 ms 320 KB Output is correct
16 Correct 4 ms 2644 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 8 ms 4692 KB Output is correct
19 Correct 6 ms 4552 KB Output is correct
20 Correct 7 ms 4684 KB Output is correct
21 Correct 7 ms 4780 KB Output is correct
22 Correct 7 ms 4556 KB Output is correct
23 Correct 7 ms 4636 KB Output is correct
24 Correct 8 ms 4692 KB Output is correct
25 Correct 7 ms 4564 KB Output is correct
26 Correct 7 ms 4644 KB Output is correct
27 Correct 343 ms 150472 KB Output is correct
28 Correct 1 ms 852 KB Output is correct
29 Correct 20 ms 11856 KB Output is correct
30 Correct 1 ms 852 KB Output is correct
31 Correct 242 ms 110796 KB Output is correct
32 Correct 341 ms 158328 KB Output is correct
33 Correct 344 ms 158840 KB Output is correct
34 Correct 287 ms 128444 KB Output is correct
35 Correct 348 ms 158264 KB Output is correct
36 Correct 333 ms 158788 KB Output is correct
37 Correct 368 ms 159384 KB Output is correct
38 Correct 223 ms 109804 KB Output is correct
39 Correct 233 ms 110352 KB Output is correct