답안 #252658

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
252658 2020-07-26T04:34:06 Z Mlxa Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
123 ms 158972 KB
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define x first
#define y second
using namespace std;
using ll  = long long;
#define int ll

const int N = 3003;
int n, m;
char s[N][N];
int a[N][N];
int b[N][N];
int ans = 0;

signed main() {
#ifdef LC
    assert(freopen("input.txt", "r", stdin));
#endif
    ios::sync_with_stdio(0), cin.tie(0);
	cin >> n >> m;
	for (int i = 0; i < n; ++i) {
		cin >> s[i];
	}
	for (int i = n - 1; i >= 0; --i) {
		for (int j = m - 1; j >= 0; --j) {
			a[i][j] = a[i][j + 1] + (s[i][j] == 'O');
			b[i][j] = b[i + 1][j] + (s[i][j] == 'I');
			if (s[i][j] == 'J') {
				ans += a[i][j + 1] * b[i + 1][j];
			}
		}
	}
	cout << ans << "\n";
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Correct 1 ms 1664 KB Output is correct
6 Correct 1 ms 1536 KB Output is correct
7 Correct 1 ms 1536 KB Output is correct
8 Correct 1 ms 1664 KB Output is correct
9 Correct 1 ms 1536 KB Output is correct
10 Correct 1 ms 1536 KB Output is correct
11 Correct 1 ms 1664 KB Output is correct
12 Correct 1 ms 1536 KB Output is correct
13 Correct 1 ms 1536 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Correct 1 ms 1664 KB Output is correct
6 Correct 1 ms 1536 KB Output is correct
7 Correct 1 ms 1536 KB Output is correct
8 Correct 1 ms 1664 KB Output is correct
9 Correct 1 ms 1536 KB Output is correct
10 Correct 1 ms 1536 KB Output is correct
11 Correct 1 ms 1664 KB Output is correct
12 Correct 1 ms 1536 KB Output is correct
13 Correct 1 ms 1536 KB Output is correct
14 Correct 6 ms 9088 KB Output is correct
15 Correct 3 ms 5120 KB Output is correct
16 Correct 3 ms 5376 KB Output is correct
17 Correct 1 ms 512 KB Output is correct
18 Correct 8 ms 9984 KB Output is correct
19 Correct 6 ms 9856 KB Output is correct
20 Correct 6 ms 9856 KB Output is correct
21 Correct 6 ms 9984 KB Output is correct
22 Correct 6 ms 9856 KB Output is correct
23 Correct 6 ms 9856 KB Output is correct
24 Correct 7 ms 9984 KB Output is correct
25 Correct 6 ms 9856 KB Output is correct
26 Correct 7 ms 9848 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 512 KB Output is correct
5 Correct 1 ms 1664 KB Output is correct
6 Correct 1 ms 1536 KB Output is correct
7 Correct 1 ms 1536 KB Output is correct
8 Correct 1 ms 1664 KB Output is correct
9 Correct 1 ms 1536 KB Output is correct
10 Correct 1 ms 1536 KB Output is correct
11 Correct 1 ms 1664 KB Output is correct
12 Correct 1 ms 1536 KB Output is correct
13 Correct 1 ms 1536 KB Output is correct
14 Correct 6 ms 9088 KB Output is correct
15 Correct 3 ms 5120 KB Output is correct
16 Correct 3 ms 5376 KB Output is correct
17 Correct 1 ms 512 KB Output is correct
18 Correct 8 ms 9984 KB Output is correct
19 Correct 6 ms 9856 KB Output is correct
20 Correct 6 ms 9856 KB Output is correct
21 Correct 6 ms 9984 KB Output is correct
22 Correct 6 ms 9856 KB Output is correct
23 Correct 6 ms 9856 KB Output is correct
24 Correct 7 ms 9984 KB Output is correct
25 Correct 6 ms 9856 KB Output is correct
26 Correct 7 ms 9848 KB Output is correct
27 Correct 113 ms 158456 KB Output is correct
28 Correct 15 ms 26368 KB Output is correct
29 Correct 9 ms 13948 KB Output is correct
30 Correct 1 ms 896 KB Output is correct
31 Correct 91 ms 131320 KB Output is correct
32 Correct 108 ms 158972 KB Output is correct
33 Correct 99 ms 158456 KB Output is correct
34 Correct 108 ms 152316 KB Output is correct
35 Correct 99 ms 158968 KB Output is correct
36 Correct 98 ms 158456 KB Output is correct
37 Correct 123 ms 158968 KB Output is correct
38 Correct 78 ms 130808 KB Output is correct
39 Correct 81 ms 130808 KB Output is correct