답안 #533591

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
533591 2022-03-06T13:15:40 Z alvingogo Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
229 ms 89604 KB
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define AquA cin.tie(0);ios_base::sync_with_stdio(0);
#define fs first
#define sc second
#define cd complex<double>
#define p_q priority_queue
using namespace std;


int main(){
	AquA;
	int n,m;
	cin >> n >> m;
	long long ans=0;
	vector<string> v(n);
	for(int i=0;i<n;i++){
		cin >> v[i];
	}
	vector<vector<int> > p1(n,vector<int>(m)),p2(n,vector<int>(m));
	for(int i=0;i<n;i++){
		p1[i][m-1]=(v[i][m-1]=='O');
		for(int j=m-2;j>=0;j--){
			p1[i][j]=p1[i][j+1]+(v[i][j]=='O');
		}
	}
	for(int j=0;j<m;j++){
		p2[n-1][j]=(v[n-1][j]=='I');
		for(int i=n-2;i>=0;i--){
			p2[i][j]=p2[i+1][j]+(v[i][j]=='I');
		}
	}	
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			if(v[i][j]=='J'){
				ans+=p1[i][j]*p2[i][j];
			}
		}
	}
	cout << ans << "\n";
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 308 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 324 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 308 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 324 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 4 ms 2252 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 2 ms 1484 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 4 ms 2736 KB Output is correct
19 Correct 3 ms 2636 KB Output is correct
20 Correct 4 ms 2748 KB Output is correct
21 Correct 5 ms 2764 KB Output is correct
22 Correct 4 ms 2616 KB Output is correct
23 Correct 4 ms 2756 KB Output is correct
24 Correct 5 ms 2788 KB Output is correct
25 Correct 3 ms 2624 KB Output is correct
26 Correct 4 ms 2680 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 308 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 324 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 4 ms 2252 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 2 ms 1484 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 4 ms 2736 KB Output is correct
19 Correct 3 ms 2636 KB Output is correct
20 Correct 4 ms 2748 KB Output is correct
21 Correct 5 ms 2764 KB Output is correct
22 Correct 4 ms 2616 KB Output is correct
23 Correct 4 ms 2756 KB Output is correct
24 Correct 5 ms 2788 KB Output is correct
25 Correct 3 ms 2624 KB Output is correct
26 Correct 4 ms 2680 KB Output is correct
27 Correct 208 ms 84560 KB Output is correct
28 Correct 2 ms 716 KB Output is correct
29 Correct 9 ms 6720 KB Output is correct
30 Correct 1 ms 460 KB Output is correct
31 Correct 149 ms 62256 KB Output is correct
32 Correct 199 ms 89084 KB Output is correct
33 Correct 189 ms 89236 KB Output is correct
34 Correct 175 ms 72380 KB Output is correct
35 Correct 198 ms 88868 KB Output is correct
36 Correct 200 ms 89412 KB Output is correct
37 Correct 229 ms 89604 KB Output is correct
38 Correct 140 ms 61776 KB Output is correct
39 Correct 132 ms 61916 KB Output is correct