답안 #209208

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
209208 2020-03-13T12:13:24 Z origami100 Bitaro the Brave (JOI19_ho_t1) C++11
100 / 100
572 ms 150396 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll h, w;
	cin >> h >> w;
	vector <string> grid;
	for(ll i = 0; i < h; i++){
		string s;
		cin >> s;
		grid.push_back(s);
	}
	ll O[h][w], I[h][w];
	for(ll i = 0; i < h; i++){
		O[i][w - 1] = (grid[i][w - 1] == 'O')?1:0;
	}
	for(ll i = 0; i < w; i++){
		I[h - 1][i] = (grid[h - 1][i] == 'I')?1:0;
	}
	ll cnt = 0;
	for(ll i = h - 2; i >= 0; i--){
		for(ll j = w - 2; j >= 0; j--){
			switch(grid[i][j]){
				case 'J':
					I[i][j] = I[i + 1][j];
					O[i][j] = O[i][j + 1];
					cnt += I[i][j] * O[i][j];
					break;
				case 'O':
					I[i][j] = I[i + 1][j];
					O[i][j] = O[i][j + 1] + 1;
					break;
				case 'I':
					I[i][j] = I[i + 1][j] + 1;
					O[i][j] = O[i][j + 1];
					break;
			}
		}
	}
	cout << cnt;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 6 ms 504 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 504 KB Output is correct
8 Correct 5 ms 504 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 504 KB Output is correct
11 Correct 5 ms 504 KB Output is correct
12 Correct 6 ms 376 KB Output is correct
13 Correct 5 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 6 ms 504 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 504 KB Output is correct
8 Correct 5 ms 504 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 504 KB Output is correct
11 Correct 5 ms 504 KB Output is correct
12 Correct 6 ms 376 KB Output is correct
13 Correct 5 ms 504 KB Output is correct
14 Correct 17 ms 3576 KB Output is correct
15 Correct 6 ms 376 KB Output is correct
16 Correct 12 ms 2424 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 21 ms 4472 KB Output is correct
19 Correct 19 ms 4344 KB Output is correct
20 Correct 20 ms 4344 KB Output is correct
21 Correct 21 ms 4600 KB Output is correct
22 Correct 20 ms 4472 KB Output is correct
23 Correct 20 ms 4472 KB Output is correct
24 Correct 22 ms 4600 KB Output is correct
25 Correct 19 ms 4472 KB Output is correct
26 Correct 19 ms 4600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 6 ms 504 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 504 KB Output is correct
8 Correct 5 ms 504 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 504 KB Output is correct
11 Correct 5 ms 504 KB Output is correct
12 Correct 6 ms 376 KB Output is correct
13 Correct 5 ms 504 KB Output is correct
14 Correct 17 ms 3576 KB Output is correct
15 Correct 6 ms 376 KB Output is correct
16 Correct 12 ms 2424 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 21 ms 4472 KB Output is correct
19 Correct 19 ms 4344 KB Output is correct
20 Correct 20 ms 4344 KB Output is correct
21 Correct 21 ms 4600 KB Output is correct
22 Correct 20 ms 4472 KB Output is correct
23 Correct 20 ms 4472 KB Output is correct
24 Correct 22 ms 4600 KB Output is correct
25 Correct 19 ms 4472 KB Output is correct
26 Correct 19 ms 4600 KB Output is correct
27 Correct 544 ms 142072 KB Output is correct
28 Correct 7 ms 1016 KB Output is correct
29 Correct 42 ms 11256 KB Output is correct
30 Correct 7 ms 632 KB Output is correct
31 Correct 398 ms 104568 KB Output is correct
32 Correct 524 ms 149368 KB Output is correct
33 Correct 526 ms 150008 KB Output is correct
34 Correct 487 ms 121368 KB Output is correct
35 Correct 524 ms 149368 KB Output is correct
36 Correct 529 ms 150136 KB Output is correct
37 Correct 572 ms 150396 KB Output is correct
38 Correct 367 ms 103800 KB Output is correct
39 Correct 371 ms 104184 KB Output is correct