답안 #123573

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
123573 2019-07-01T17:02:23 Z naderjemel Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
953 ms 91148 KB
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<pair<int,int> > vii;
int cumx[3005][3005];
int cumy[3005][3005];

int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	vector<string> v(n);
	for(int i=0;i<n;i++){
		cin>>v[i];
	}
	for(int i=0;i<n;i++){
		for(int j=m-1;j>=0;j--){
			cumy[i][j]=cumy[i][j+1];
			if(v[i][j]=='O') cumy[i][j]++;
		}
	}
	for(int j=0;j<m;j++){
		for(int i=n-1;i>=0;i--){
			cumx[i][j]=cumx[i+1][j];
			if(v[i][j]=='I') cumx[i][j]++;
		}
	}
	ll rs=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			if(v[i][j]=='J'){
				rs+=cumx[i][j]*cumy[i][j];
			}
		}
	}
	printf("%lld\n", rs);
	return 0;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:16:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&n,&m);
  ~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 1272 KB Output is correct
6 Correct 3 ms 1148 KB Output is correct
7 Correct 3 ms 1144 KB Output is correct
8 Correct 3 ms 1272 KB Output is correct
9 Correct 3 ms 1272 KB Output is correct
10 Correct 3 ms 1144 KB Output is correct
11 Correct 4 ms 1272 KB Output is correct
12 Correct 3 ms 1148 KB Output is correct
13 Correct 3 ms 1144 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 1272 KB Output is correct
6 Correct 3 ms 1148 KB Output is correct
7 Correct 3 ms 1144 KB Output is correct
8 Correct 3 ms 1272 KB Output is correct
9 Correct 3 ms 1272 KB Output is correct
10 Correct 3 ms 1144 KB Output is correct
11 Correct 4 ms 1272 KB Output is correct
12 Correct 3 ms 1148 KB Output is correct
13 Correct 3 ms 1144 KB Output is correct
14 Correct 23 ms 6264 KB Output is correct
15 Correct 6 ms 3832 KB Output is correct
16 Correct 13 ms 3832 KB Output is correct
17 Correct 2 ms 504 KB Output is correct
18 Correct 26 ms 7032 KB Output is correct
19 Correct 23 ms 6652 KB Output is correct
20 Correct 23 ms 7032 KB Output is correct
21 Correct 26 ms 7032 KB Output is correct
22 Correct 23 ms 6776 KB Output is correct
23 Correct 24 ms 6904 KB Output is correct
24 Correct 27 ms 7032 KB Output is correct
25 Correct 23 ms 6648 KB Output is correct
26 Correct 23 ms 6904 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 3 ms 1272 KB Output is correct
6 Correct 3 ms 1148 KB Output is correct
7 Correct 3 ms 1144 KB Output is correct
8 Correct 3 ms 1272 KB Output is correct
9 Correct 3 ms 1272 KB Output is correct
10 Correct 3 ms 1144 KB Output is correct
11 Correct 4 ms 1272 KB Output is correct
12 Correct 3 ms 1148 KB Output is correct
13 Correct 3 ms 1144 KB Output is correct
14 Correct 23 ms 6264 KB Output is correct
15 Correct 6 ms 3832 KB Output is correct
16 Correct 13 ms 3832 KB Output is correct
17 Correct 2 ms 504 KB Output is correct
18 Correct 26 ms 7032 KB Output is correct
19 Correct 23 ms 6652 KB Output is correct
20 Correct 23 ms 7032 KB Output is correct
21 Correct 26 ms 7032 KB Output is correct
22 Correct 23 ms 6776 KB Output is correct
23 Correct 24 ms 6904 KB Output is correct
24 Correct 27 ms 7032 KB Output is correct
25 Correct 23 ms 6648 KB Output is correct
26 Correct 23 ms 6904 KB Output is correct
27 Correct 925 ms 90784 KB Output is correct
28 Correct 22 ms 19320 KB Output is correct
29 Correct 49 ms 8056 KB Output is correct
30 Correct 4 ms 632 KB Output is correct
31 Correct 671 ms 74872 KB Output is correct
32 Correct 854 ms 91016 KB Output is correct
33 Correct 844 ms 90792 KB Output is correct
34 Correct 782 ms 86692 KB Output is correct
35 Correct 867 ms 91148 KB Output is correct
36 Correct 852 ms 90788 KB Output is correct
37 Correct 953 ms 91144 KB Output is correct
38 Correct 610 ms 74888 KB Output is correct
39 Correct 597 ms 74588 KB Output is correct