답안 #220392

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
220392 2020-04-07T19:48:56 Z hanagasumi Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
190 ms 17916 KB
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <deque>
#include <map>
#include <set>
#include <complex>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <random>

#define ft first
#define sc second
#define pb push_back
#define len(v) (int)v.size()
#define int ll

using namespace std;
typedef long long ll;

signed main() {
	 #ifdef PC 
		freopen("in.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int h, w;
	cin >> h >> w;
	vector<vector<char>> mat(h, vector<char>(w));
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> mat[i][j];
		}
	}

	int ans = 0;
	vector<int> have(w, 0);
	for (int i = h - 1; i >= 0; i--) {
		int now = 0;
		for (int j = w - 1; j >= 0; j--) {
			if(mat[i][j] == 'I') 
				have[j]++;
			if(mat[i][j] == 'O')
				now++;
			if(mat[i][j] == 'J') {
				ans += have[j] * now;
			}
		}
	}
	cout << ans << '\n';
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 9 ms 768 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 7 ms 640 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 10 ms 768 KB Output is correct
19 Correct 8 ms 896 KB Output is correct
20 Correct 8 ms 768 KB Output is correct
21 Correct 10 ms 896 KB Output is correct
22 Correct 8 ms 768 KB Output is correct
23 Correct 8 ms 768 KB Output is correct
24 Correct 10 ms 896 KB Output is correct
25 Correct 8 ms 768 KB Output is correct
26 Correct 8 ms 896 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 9 ms 768 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 7 ms 640 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 10 ms 768 KB Output is correct
19 Correct 8 ms 896 KB Output is correct
20 Correct 8 ms 768 KB Output is correct
21 Correct 10 ms 896 KB Output is correct
22 Correct 8 ms 768 KB Output is correct
23 Correct 8 ms 768 KB Output is correct
24 Correct 10 ms 896 KB Output is correct
25 Correct 8 ms 768 KB Output is correct
26 Correct 8 ms 896 KB Output is correct
27 Correct 187 ms 17144 KB Output is correct
28 Correct 5 ms 512 KB Output is correct
29 Correct 16 ms 1664 KB Output is correct
30 Correct 5 ms 384 KB Output is correct
31 Correct 143 ms 12664 KB Output is correct
32 Correct 150 ms 17916 KB Output is correct
33 Correct 140 ms 17912 KB Output is correct
34 Correct 162 ms 14584 KB Output is correct
35 Correct 146 ms 17784 KB Output is correct
36 Correct 145 ms 17912 KB Output is correct
37 Correct 190 ms 17912 KB Output is correct
38 Correct 103 ms 12536 KB Output is correct
39 Correct 101 ms 12664 KB Output is correct