답안 #934380

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
934380 2024-02-27T09:08:02 Z SmuggingSpun Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
197 ms 18044 KB
#include<bits/stdc++.h>
#define taskname "ho-t1"
using namespace std;
typedef long long ll;
const int lim = 3005;
int r[lim];
char a[lim][lim];
int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	if(fopen(taskname".inp", "r")){
		freopen(taskname".inp", "r", stdin);
	}
	int n, m;
	cin >> n >> m;
	memset(r, 0, sizeof(r));
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= m; j++){
			cin >> a[i][j];
			if(a[i][j] == 'O'){
				r[i]++;
			}
		}
	}
	ll ans = 0;
	for(int j = 1; j <= m; j++){
		int cnt_i = 0;
		for(int i = 1; i <= n; i++){
			if(a[i][j] == 'I'){
				cnt_i++;
			}
		}
		for(int i = 1; i <= n; i++){
			if(a[i][j] == 'O'){
				r[i]--;
			}
			else if(a[i][j] == 'I'){
				cnt_i--;
			}
			else{
				ans += r[i] * cnt_i;
			}
		}
	}
	cout << ans;
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:11:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |   freopen(taskname".inp", "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 2520 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 1 ms 2652 KB Output is correct
9 Correct 1 ms 2652 KB Output is correct
10 Correct 1 ms 2652 KB Output is correct
11 Correct 1 ms 2652 KB Output is correct
12 Correct 1 ms 2652 KB Output is correct
13 Correct 1 ms 2652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 2520 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 1 ms 2652 KB Output is correct
9 Correct 1 ms 2652 KB Output is correct
10 Correct 1 ms 2652 KB Output is correct
11 Correct 1 ms 2652 KB Output is correct
12 Correct 1 ms 2652 KB Output is correct
13 Correct 1 ms 2652 KB Output is correct
14 Correct 5 ms 2652 KB Output is correct
15 Correct 1 ms 2652 KB Output is correct
16 Correct 2 ms 2652 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 7 ms 2908 KB Output is correct
19 Correct 4 ms 2908 KB Output is correct
20 Correct 3 ms 2784 KB Output is correct
21 Correct 6 ms 2904 KB Output is correct
22 Correct 4 ms 2908 KB Output is correct
23 Correct 3 ms 2908 KB Output is correct
24 Correct 6 ms 2908 KB Output is correct
25 Correct 4 ms 2904 KB Output is correct
26 Correct 4 ms 2952 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 2520 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 1 ms 2652 KB Output is correct
9 Correct 1 ms 2652 KB Output is correct
10 Correct 1 ms 2652 KB Output is correct
11 Correct 1 ms 2652 KB Output is correct
12 Correct 1 ms 2652 KB Output is correct
13 Correct 1 ms 2652 KB Output is correct
14 Correct 5 ms 2652 KB Output is correct
15 Correct 1 ms 2652 KB Output is correct
16 Correct 2 ms 2652 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 7 ms 2908 KB Output is correct
19 Correct 4 ms 2908 KB Output is correct
20 Correct 3 ms 2784 KB Output is correct
21 Correct 6 ms 2904 KB Output is correct
22 Correct 4 ms 2908 KB Output is correct
23 Correct 3 ms 2908 KB Output is correct
24 Correct 6 ms 2908 KB Output is correct
25 Correct 4 ms 2904 KB Output is correct
26 Correct 4 ms 2952 KB Output is correct
27 Correct 180 ms 17492 KB Output is correct
28 Correct 3 ms 8796 KB Output is correct
29 Correct 11 ms 3164 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 133 ms 14840 KB Output is correct
32 Correct 131 ms 18000 KB Output is correct
33 Correct 96 ms 17796 KB Output is correct
34 Correct 153 ms 15832 KB Output is correct
35 Correct 128 ms 18000 KB Output is correct
36 Correct 102 ms 17824 KB Output is correct
37 Correct 197 ms 18044 KB Output is correct
38 Correct 82 ms 14860 KB Output is correct
39 Correct 67 ms 14928 KB Output is correct