답안 #99004

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
99004 2019-02-28T05:08:50 Z 구재현(#2854, gs14004) Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
247 ms 79784 KB
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3005;
using lint = long long;

int n, m;
char str[MAXN][MAXN];
int OS[MAXN][MAXN];
int IS[MAXN][MAXN];

int main(){
	scanf("%d %d",&n,&m);
	for(int i=1; i<=n; i++){
		scanf("%s", str[i] + 1);
		for(int j=1; j<=m; j++){
			if(str[i][j] == 'O') OS[i][j]++;
			if(str[i][j] == 'I') IS[i][j]++;
		}
	}
	for(int i=1; i<=n; i++){
		for(int j=1; j<=m; j++){
			OS[i][j] += OS[i][j-1];
			IS[i][j] += IS[i-1][j];
		}
	}
	lint ret = 0;
	for(int i=1; i<=n; i++){
		for(int j=1; j<=m; j++){
			if(str[i][j] == 'J'){
				ret += (OS[i][m] - OS[i][j]) * (IS[n][j] - IS[i][j]);
			}
		}
	}
	cout << ret << endl;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d",&n,&m);
  ~~~~~^~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:14:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s", str[i] + 1);
   ~~~~~^~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 428 KB Output is correct
5 Correct 3 ms 1536 KB Output is correct
6 Correct 3 ms 1536 KB Output is correct
7 Correct 3 ms 1408 KB Output is correct
8 Correct 3 ms 1536 KB Output is correct
9 Correct 3 ms 1536 KB Output is correct
10 Correct 3 ms 1408 KB Output is correct
11 Correct 3 ms 1536 KB Output is correct
12 Correct 3 ms 1536 KB Output is correct
13 Correct 3 ms 1408 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 428 KB Output is correct
5 Correct 3 ms 1536 KB Output is correct
6 Correct 3 ms 1536 KB Output is correct
7 Correct 3 ms 1408 KB Output is correct
8 Correct 3 ms 1536 KB Output is correct
9 Correct 3 ms 1536 KB Output is correct
10 Correct 3 ms 1408 KB Output is correct
11 Correct 3 ms 1536 KB Output is correct
12 Correct 3 ms 1536 KB Output is correct
13 Correct 3 ms 1408 KB Output is correct
14 Correct 12 ms 7368 KB Output is correct
15 Correct 6 ms 4992 KB Output is correct
16 Correct 7 ms 4176 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 11 ms 7808 KB Output is correct
19 Correct 13 ms 7724 KB Output is correct
20 Correct 12 ms 7552 KB Output is correct
21 Correct 13 ms 7808 KB Output is correct
22 Correct 9 ms 7680 KB Output is correct
23 Correct 12 ms 7552 KB Output is correct
24 Correct 14 ms 7808 KB Output is correct
25 Correct 10 ms 7680 KB Output is correct
26 Correct 11 ms 7552 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 428 KB Output is correct
5 Correct 3 ms 1536 KB Output is correct
6 Correct 3 ms 1536 KB Output is correct
7 Correct 3 ms 1408 KB Output is correct
8 Correct 3 ms 1536 KB Output is correct
9 Correct 3 ms 1536 KB Output is correct
10 Correct 3 ms 1408 KB Output is correct
11 Correct 3 ms 1536 KB Output is correct
12 Correct 3 ms 1536 KB Output is correct
13 Correct 3 ms 1408 KB Output is correct
14 Correct 12 ms 7368 KB Output is correct
15 Correct 6 ms 4992 KB Output is correct
16 Correct 7 ms 4176 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 11 ms 7808 KB Output is correct
19 Correct 13 ms 7724 KB Output is correct
20 Correct 12 ms 7552 KB Output is correct
21 Correct 13 ms 7808 KB Output is correct
22 Correct 9 ms 7680 KB Output is correct
23 Correct 12 ms 7552 KB Output is correct
24 Correct 14 ms 7808 KB Output is correct
25 Correct 10 ms 7680 KB Output is correct
26 Correct 11 ms 7552 KB Output is correct
27 Correct 207 ms 79784 KB Output is correct
28 Correct 23 ms 25984 KB Output is correct
29 Correct 12 ms 7168 KB Output is correct
30 Correct 3 ms 640 KB Output is correct
31 Correct 156 ms 66424 KB Output is correct
32 Correct 134 ms 79740 KB Output is correct
33 Correct 132 ms 79572 KB Output is correct
34 Correct 186 ms 77176 KB Output is correct
35 Correct 142 ms 79708 KB Output is correct
36 Correct 130 ms 79412 KB Output is correct
37 Correct 247 ms 79704 KB Output is correct
38 Correct 102 ms 66424 KB Output is correct
39 Correct 102 ms 66268 KB Output is correct