답안 #220151

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
220151 2020-04-07T07:09:20 Z anatolik Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
312 ms 89464 KB
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#define ll long long

using namespace std;

const int MAXN = 3005;

int numb1[MAXN][MAXN];
int numb2[MAXN][MAXN];

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, m;
	cin >> n >> m;
	vector<string> mat(n);
	for (int i = 0; i < n; i++) {
		cin >> mat[i];
	}
	for (int i = 0; i < n; i++) {
		int now = 0;
		for (int j = m - 1; j >= 0; j--) {
			if (mat[i][j] == 'O')
				now++;
			numb1[i][j] = now;
		}
	}
	for (int j = 0; j < m; j++) {
		int now = 0;
		for (int i = n - 1; i >= 0; i--) {
			if (mat[i][j] == 'I')
				now++;
			numb2[i][j] = now;
		}
	}
	ll ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (mat[i][j] == 'J')
				ans += numb1[i][j] * numb2[i][j];
		}
		//cerr << endl;
	}
	cout << ans << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 8 ms 384 KB Output is correct
5 Correct 5 ms 1408 KB Output is correct
6 Correct 5 ms 1152 KB Output is correct
7 Correct 5 ms 1152 KB Output is correct
8 Correct 5 ms 1280 KB Output is correct
9 Correct 5 ms 1280 KB Output is correct
10 Correct 5 ms 1152 KB Output is correct
11 Correct 5 ms 1280 KB Output is correct
12 Correct 5 ms 1280 KB Output is correct
13 Correct 5 ms 1152 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 8 ms 384 KB Output is correct
5 Correct 5 ms 1408 KB Output is correct
6 Correct 5 ms 1152 KB Output is correct
7 Correct 5 ms 1152 KB Output is correct
8 Correct 5 ms 1280 KB Output is correct
9 Correct 5 ms 1280 KB Output is correct
10 Correct 5 ms 1152 KB Output is correct
11 Correct 5 ms 1280 KB Output is correct
12 Correct 5 ms 1280 KB Output is correct
13 Correct 5 ms 1152 KB Output is correct
14 Correct 9 ms 6272 KB Output is correct
15 Correct 7 ms 3840 KB Output is correct
16 Correct 10 ms 3712 KB Output is correct
17 Correct 5 ms 512 KB Output is correct
18 Correct 10 ms 6784 KB Output is correct
19 Correct 9 ms 6784 KB Output is correct
20 Correct 9 ms 6656 KB Output is correct
21 Correct 10 ms 6912 KB Output is correct
22 Correct 9 ms 6784 KB Output is correct
23 Correct 9 ms 6656 KB Output is correct
24 Correct 10 ms 6784 KB Output is correct
25 Correct 9 ms 6784 KB Output is correct
26 Correct 9 ms 6656 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 8 ms 384 KB Output is correct
5 Correct 5 ms 1408 KB Output is correct
6 Correct 5 ms 1152 KB Output is correct
7 Correct 5 ms 1152 KB Output is correct
8 Correct 5 ms 1280 KB Output is correct
9 Correct 5 ms 1280 KB Output is correct
10 Correct 5 ms 1152 KB Output is correct
11 Correct 5 ms 1280 KB Output is correct
12 Correct 5 ms 1280 KB Output is correct
13 Correct 5 ms 1152 KB Output is correct
14 Correct 9 ms 6272 KB Output is correct
15 Correct 7 ms 3840 KB Output is correct
16 Correct 10 ms 3712 KB Output is correct
17 Correct 5 ms 512 KB Output is correct
18 Correct 10 ms 6784 KB Output is correct
19 Correct 9 ms 6784 KB Output is correct
20 Correct 9 ms 6656 KB Output is correct
21 Correct 10 ms 6912 KB Output is correct
22 Correct 9 ms 6784 KB Output is correct
23 Correct 9 ms 6656 KB Output is correct
24 Correct 10 ms 6784 KB Output is correct
25 Correct 9 ms 6784 KB Output is correct
26 Correct 9 ms 6656 KB Output is correct
27 Correct 297 ms 88444 KB Output is correct
28 Correct 13 ms 19328 KB Output is correct
29 Correct 11 ms 7808 KB Output is correct
30 Correct 5 ms 640 KB Output is correct
31 Correct 216 ms 72056 KB Output is correct
32 Correct 276 ms 89336 KB Output is correct
33 Correct 285 ms 89244 KB Output is correct
34 Correct 242 ms 83448 KB Output is correct
35 Correct 279 ms 89336 KB Output is correct
36 Correct 283 ms 89300 KB Output is correct
37 Correct 312 ms 89464 KB Output is correct
38 Correct 188 ms 71800 KB Output is correct
39 Correct 189 ms 71800 KB Output is correct