답안 #734066

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
734066 2023-05-01T15:47:27 Z LCJLY Bitaro the Brave (JOI19_ho_t1) C++14
0 / 100
1 ms 212 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[x][y]=='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 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -