답안 #208555

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
208555 2020-03-11T14:37:13 Z huangqr Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
585 ms 108056 KB
#include <bits/stdc++.h>
#define SZ 3005
using namespace std;
int h,w,rowo[SZ][SZ],coli[SZ][SZ];

int main() {
	long long sum=0;
	vector<pair<int,int> >coords;
	string s;
	cin>>h>>w;
	for(int i=1;i<=h;i++){
		cin>>s;
		for(int j=1;j<=w;j++){
			rowo[i][j]=rowo[i][j-1];
			coli[i][j]=coli[i-1][j];
			if(s[j-1]=='J')coords.emplace_back(i,j);
			else if(s[j-1]=='O')rowo[i][j]++;
			else if(s[j-1]=='I')coli[i][j]++;
		}
	}
/*	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			cout<<rowo[i][j]<<" ";
		}
		cout<<"\n";
	}
	cout<<"\n";
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			cout<<coli[i][j]<<" ";
		}
		cout<<"\n";
	}*/
	for(auto x:coords){
		sum+=(rowo[x.first][w]-rowo[x.first][x.second])*(coli[h][x.second]-coli[x.first][x.second]);
	}
	cout<<sum;
	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 6 ms 1272 KB Output is correct
6 Correct 6 ms 1272 KB Output is correct
7 Correct 5 ms 1144 KB Output is correct
8 Correct 6 ms 1276 KB Output is correct
9 Correct 6 ms 1272 KB Output is correct
10 Correct 6 ms 1272 KB Output is correct
11 Correct 6 ms 1272 KB Output is correct
12 Correct 6 ms 1272 KB Output is correct
13 Correct 5 ms 1144 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 6 ms 1272 KB Output is correct
6 Correct 6 ms 1272 KB Output is correct
7 Correct 5 ms 1144 KB Output is correct
8 Correct 6 ms 1276 KB Output is correct
9 Correct 6 ms 1272 KB Output is correct
10 Correct 6 ms 1272 KB Output is correct
11 Correct 6 ms 1272 KB Output is correct
12 Correct 6 ms 1272 KB Output is correct
13 Correct 5 ms 1144 KB Output is correct
14 Correct 19 ms 6640 KB Output is correct
15 Correct 9 ms 3832 KB Output is correct
16 Correct 13 ms 4080 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 23 ms 7276 KB Output is correct
19 Correct 20 ms 6772 KB Output is correct
20 Correct 21 ms 7148 KB Output is correct
21 Correct 27 ms 7272 KB Output is correct
22 Correct 22 ms 7272 KB Output is correct
23 Correct 21 ms 7148 KB Output is correct
24 Correct 24 ms 7532 KB Output is correct
25 Correct 24 ms 6772 KB Output is correct
26 Correct 21 ms 7148 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 6 ms 1272 KB Output is correct
6 Correct 6 ms 1272 KB Output is correct
7 Correct 5 ms 1144 KB Output is correct
8 Correct 6 ms 1276 KB Output is correct
9 Correct 6 ms 1272 KB Output is correct
10 Correct 6 ms 1272 KB Output is correct
11 Correct 6 ms 1272 KB Output is correct
12 Correct 6 ms 1272 KB Output is correct
13 Correct 5 ms 1144 KB Output is correct
14 Correct 19 ms 6640 KB Output is correct
15 Correct 9 ms 3832 KB Output is correct
16 Correct 13 ms 4080 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 23 ms 7276 KB Output is correct
19 Correct 20 ms 6772 KB Output is correct
20 Correct 21 ms 7148 KB Output is correct
21 Correct 27 ms 7272 KB Output is correct
22 Correct 22 ms 7272 KB Output is correct
23 Correct 21 ms 7148 KB Output is correct
24 Correct 24 ms 7532 KB Output is correct
25 Correct 24 ms 6772 KB Output is correct
26 Correct 21 ms 7148 KB Output is correct
27 Correct 543 ms 101148 KB Output is correct
28 Correct 17 ms 19448 KB Output is correct
29 Correct 43 ms 9060 KB Output is correct
30 Correct 7 ms 760 KB Output is correct
31 Correct 403 ms 81340 KB Output is correct
32 Correct 488 ms 86480 KB Output is correct
33 Correct 518 ms 103100 KB Output is correct
34 Correct 471 ms 99392 KB Output is correct
35 Correct 523 ms 102532 KB Output is correct
36 Correct 514 ms 103064 KB Output is correct
37 Correct 585 ms 108056 KB Output is correct
38 Correct 350 ms 70352 KB Output is correct
39 Correct 358 ms 81480 KB Output is correct