답안 #208464

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
208464 2020-03-11T09:23:16 Z AlainSu Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
913 ms 154220 KB
#include<bits/stdc++.h>
using namespace std;
const int MAXN=3003, MAXM=3003;
char s[3010][3010]={};
long long O[MAXN][MAXM]={},I[MAXN][MAXM]={},n,m;
long long ans=0;
void input()
{
	cin>>n>>m;
	for (int i=1;i<=n;i++)
	    for (int j=1;j<=m;j++)
	         cin>>s[i][j];
}
void getO()
{
	for (int i=1;i<=n;i++)
	     for (int j=1;j<=m;j++)
	         {
	         	if (j!=1) {O[i][j]=O[i][j-1];};
	         	if (s[i][j]=='O') {O[i][j]++;}; 
			 }
}
void getI()
{
	for (int i=1;i<=n;i++)
	   for (int j=1;j<=m;j++)
	        {
	        	if (i!=1) {I[i][j]=I[i-1][j];};
	        	if (s[i][j]=='I') {I[i][j]++;};
			}
}
void process()
{
	for (int i=1;i<=n;i++)
	    for (int j=1;j<=m;j++)
	         if (s[i][j]=='J')
	         {
	         	ans+=(I[n][j]-I[i][j])*(O[i][m]-O[i][j]);
			 }
}
void output()
{
	cout<<ans;
}
int main()
{
    input();
    getO();
    getI();
    process();
    output();
    return 0;
} 
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 7 ms 1656 KB Output is correct
6 Correct 6 ms 1528 KB Output is correct
7 Correct 6 ms 1528 KB Output is correct
8 Correct 7 ms 1660 KB Output is correct
9 Correct 6 ms 1528 KB Output is correct
10 Correct 6 ms 1528 KB Output is correct
11 Correct 6 ms 1656 KB Output is correct
12 Correct 6 ms 1528 KB Output is correct
13 Correct 7 ms 1528 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 7 ms 1656 KB Output is correct
6 Correct 6 ms 1528 KB Output is correct
7 Correct 6 ms 1528 KB Output is correct
8 Correct 7 ms 1660 KB Output is correct
9 Correct 6 ms 1528 KB Output is correct
10 Correct 6 ms 1528 KB Output is correct
11 Correct 6 ms 1656 KB Output is correct
12 Correct 6 ms 1528 KB Output is correct
13 Correct 7 ms 1528 KB Output is correct
14 Correct 27 ms 8952 KB Output is correct
15 Correct 8 ms 4984 KB Output is correct
16 Correct 21 ms 5368 KB Output is correct
17 Correct 5 ms 504 KB Output is correct
18 Correct 34 ms 9952 KB Output is correct
19 Correct 30 ms 9848 KB Output is correct
20 Correct 30 ms 9848 KB Output is correct
21 Correct 34 ms 9976 KB Output is correct
22 Correct 33 ms 9848 KB Output is correct
23 Correct 30 ms 9720 KB Output is correct
24 Correct 33 ms 9976 KB Output is correct
25 Correct 33 ms 9752 KB Output is correct
26 Correct 31 ms 9720 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 7 ms 1656 KB Output is correct
6 Correct 6 ms 1528 KB Output is correct
7 Correct 6 ms 1528 KB Output is correct
8 Correct 7 ms 1660 KB Output is correct
9 Correct 6 ms 1528 KB Output is correct
10 Correct 6 ms 1528 KB Output is correct
11 Correct 6 ms 1656 KB Output is correct
12 Correct 6 ms 1528 KB Output is correct
13 Correct 7 ms 1528 KB Output is correct
14 Correct 27 ms 8952 KB Output is correct
15 Correct 8 ms 4984 KB Output is correct
16 Correct 21 ms 5368 KB Output is correct
17 Correct 5 ms 504 KB Output is correct
18 Correct 34 ms 9952 KB Output is correct
19 Correct 30 ms 9848 KB Output is correct
20 Correct 30 ms 9848 KB Output is correct
21 Correct 34 ms 9976 KB Output is correct
22 Correct 33 ms 9848 KB Output is correct
23 Correct 30 ms 9720 KB Output is correct
24 Correct 33 ms 9976 KB Output is correct
25 Correct 33 ms 9752 KB Output is correct
26 Correct 31 ms 9720 KB Output is correct
27 Correct 872 ms 154220 KB Output is correct
28 Correct 23 ms 26360 KB Output is correct
29 Correct 65 ms 13908 KB Output is correct
30 Correct 8 ms 888 KB Output is correct
31 Correct 656 ms 129172 KB Output is correct
32 Correct 901 ms 153824 KB Output is correct
33 Correct 837 ms 153304 KB Output is correct
34 Correct 793 ms 149184 KB Output is correct
35 Correct 842 ms 153592 KB Output is correct
36 Correct 825 ms 152956 KB Output is correct
37 Correct 913 ms 153564 KB Output is correct
38 Correct 602 ms 128344 KB Output is correct
39 Correct 604 ms 128120 KB Output is correct