답안 #531022

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
531022 2022-02-27T10:59:49 Z buidangnguyen05 Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
347 ms 118500 KB
/* input

*/

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
const int N = 5e3 + 10;
int d[N][N], r[N][N];
char s[N][N];

signed main() {
	cin.tie(0)->sync_with_stdio(0);
	if (fopen("task.inp", "r")) {
		freopen("task.inp", "r", stdin);
		freopen("task.out", "w", stdout);
	}
	
	int m, n; cin >> m >> n;
	for (int i = 1; i <= m; ++i) for (int j = 1; j <= n; ++j) cin >> s[i][j];

	for (int i = 1; i <= m; ++i) for (int j = n; j; --j) r[i][j] = r[i][j + 1] + (s[i][j + 1] == 'O');
	for (int j = 1; j <= n; ++j) for (int i = m; i; --i) d[i][j] = d[i + 1][j] + (s[i + 1][j] == 'I');
		
	ll res = 0;
	for (int i = 1; i <= m; ++i) for (int j = 1; j <= n; ++j) if (s[i][j] == 'J') res += r[i][j] * d[i][j];

	cout << res << "\n";
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:16:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |   freopen("task.inp", "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:17:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |   freopen("task.out", "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 460 KB Output is correct
5 Correct 1 ms 1612 KB Output is correct
6 Correct 1 ms 1612 KB Output is correct
7 Correct 1 ms 1484 KB Output is correct
8 Correct 1 ms 1616 KB Output is correct
9 Correct 2 ms 1600 KB Output is correct
10 Correct 1 ms 1484 KB Output is correct
11 Correct 1 ms 1612 KB Output is correct
12 Correct 1 ms 1612 KB Output is correct
13 Correct 1 ms 1484 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 460 KB Output is correct
5 Correct 1 ms 1612 KB Output is correct
6 Correct 1 ms 1612 KB Output is correct
7 Correct 1 ms 1484 KB Output is correct
8 Correct 1 ms 1616 KB Output is correct
9 Correct 2 ms 1600 KB Output is correct
10 Correct 1 ms 1484 KB Output is correct
11 Correct 1 ms 1612 KB Output is correct
12 Correct 1 ms 1612 KB Output is correct
13 Correct 1 ms 1484 KB Output is correct
14 Correct 8 ms 8136 KB Output is correct
15 Correct 3 ms 5452 KB Output is correct
16 Correct 6 ms 4684 KB Output is correct
17 Correct 1 ms 460 KB Output is correct
18 Correct 9 ms 8784 KB Output is correct
19 Correct 9 ms 8652 KB Output is correct
20 Correct 9 ms 8652 KB Output is correct
21 Correct 10 ms 8832 KB Output is correct
22 Correct 9 ms 8656 KB Output is correct
23 Correct 9 ms 8656 KB Output is correct
24 Correct 10 ms 8768 KB Output is correct
25 Correct 9 ms 8656 KB Output is correct
26 Correct 12 ms 8576 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 460 KB Output is correct
5 Correct 1 ms 1612 KB Output is correct
6 Correct 1 ms 1612 KB Output is correct
7 Correct 1 ms 1484 KB Output is correct
8 Correct 1 ms 1616 KB Output is correct
9 Correct 2 ms 1600 KB Output is correct
10 Correct 1 ms 1484 KB Output is correct
11 Correct 1 ms 1612 KB Output is correct
12 Correct 1 ms 1612 KB Output is correct
13 Correct 1 ms 1484 KB Output is correct
14 Correct 8 ms 8136 KB Output is correct
15 Correct 3 ms 5452 KB Output is correct
16 Correct 6 ms 4684 KB Output is correct
17 Correct 1 ms 460 KB Output is correct
18 Correct 9 ms 8784 KB Output is correct
19 Correct 9 ms 8652 KB Output is correct
20 Correct 9 ms 8652 KB Output is correct
21 Correct 10 ms 8832 KB Output is correct
22 Correct 9 ms 8656 KB Output is correct
23 Correct 9 ms 8656 KB Output is correct
24 Correct 10 ms 8768 KB Output is correct
25 Correct 9 ms 8656 KB Output is correct
26 Correct 12 ms 8576 KB Output is correct
27 Correct 329 ms 113988 KB Output is correct
28 Correct 14 ms 28620 KB Output is correct
29 Correct 18 ms 9256 KB Output is correct
30 Correct 2 ms 588 KB Output is correct
31 Correct 243 ms 87604 KB Output is correct
32 Correct 325 ms 117788 KB Output is correct
33 Correct 322 ms 118072 KB Output is correct
34 Correct 278 ms 101696 KB Output is correct
35 Correct 347 ms 117832 KB Output is correct
36 Correct 335 ms 117928 KB Output is correct
37 Correct 345 ms 118500 KB Output is correct
38 Correct 231 ms 87228 KB Output is correct
39 Correct 213 ms 87316 KB Output is correct