답안 #831037

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
831037 2023-08-19T15:34:12 Z OAleksa Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
238 ms 88516 KB
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std; 
#define int long long
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int tt = 1;
	//cin >> tt;
	while(tt--) {
		int n, m;
		cin >> n >> m;
		char a[n][m];
		for(int i = 0;i < n;i++)
			for(int j = 0;j < m;j++)
				cin >> a[i][j];
		vector<vector<int>> v(n, vector<int>(m));
		for(int i = 0;i < n;i++) {
			int p = 0;
			for(int j = m - 1;j >= 0;j--) {
				p += (a[i][j] == 'O');
				if(a[i][j] == 'J')
					v[i][j] = p;
			}
		}
		for(int i = 0;i < m;i++) {
			int p = 0;
			for(int j = n - 1;j >= 0;j--) {
				p += (a[j][i] == 'I');
				if(a[j][i] == 'J')
					v[j][i] *= p;
			}
		}
		int ans = 0;
		for(int i = 0;i < n;i++)
			for(int j = 0;j < m;j++)
				ans += v[i][j];
		cout << ans;
	}
   return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 324 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 328 KB Output is correct
12 Correct 0 ms 328 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 324 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 328 KB Output is correct
12 Correct 0 ms 328 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 4 ms 2096 KB Output is correct
15 Correct 0 ms 340 KB Output is correct
16 Correct 2 ms 1492 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 6 ms 2768 KB Output is correct
19 Correct 4 ms 2644 KB Output is correct
20 Correct 5 ms 2636 KB Output is correct
21 Correct 5 ms 2760 KB Output is correct
22 Correct 4 ms 2644 KB Output is correct
23 Correct 4 ms 2632 KB Output is correct
24 Correct 6 ms 2724 KB Output is correct
25 Correct 4 ms 2636 KB Output is correct
26 Correct 4 ms 2632 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 324 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 328 KB Output is correct
12 Correct 0 ms 328 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 4 ms 2096 KB Output is correct
15 Correct 0 ms 340 KB Output is correct
16 Correct 2 ms 1492 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 6 ms 2768 KB Output is correct
19 Correct 4 ms 2644 KB Output is correct
20 Correct 5 ms 2636 KB Output is correct
21 Correct 5 ms 2760 KB Output is correct
22 Correct 4 ms 2644 KB Output is correct
23 Correct 4 ms 2632 KB Output is correct
24 Correct 6 ms 2724 KB Output is correct
25 Correct 4 ms 2636 KB Output is correct
26 Correct 4 ms 2632 KB Output is correct
27 Correct 212 ms 83596 KB Output is correct
28 Correct 1 ms 596 KB Output is correct
29 Correct 9 ms 6612 KB Output is correct
30 Correct 1 ms 484 KB Output is correct
31 Correct 152 ms 61704 KB Output is correct
32 Correct 154 ms 87916 KB Output is correct
33 Correct 171 ms 88164 KB Output is correct
34 Correct 180 ms 71264 KB Output is correct
35 Correct 184 ms 87880 KB Output is correct
36 Correct 174 ms 88176 KB Output is correct
37 Correct 238 ms 88516 KB Output is correct
38 Correct 101 ms 61004 KB Output is correct
39 Correct 109 ms 61288 KB Output is correct