답안 #574056

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
574056 2022-06-07T16:21:43 Z MateGiorbelidze Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
167 ms 151244 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ff first
#define sc second
#define pb push_back
#define in insert

ll p[3005][3005], d[3005][3005];

int32_t main () {
	ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    ll n , m; cin>>n>>m;
    
    string s[n + 1];
    
    for (int i = 1; i <= n; i++)
    	cin>>s[i];
    
    for (int i = n; i > 0; i--) {
    	for (int j = m - 1; j >= 0; j--) {
    		
    		d[i][j] = d[i][j + 1];
    		p[i][j] = p[i + 1][j];
    		
    		if (s[i][j] == 'O') d[i][j]++;
    		if (s[i][j] == 'I') p[i][j]++;
		}
	}
	
	ll ans = 0;
	
	for (int i = n; i > 0; i--) {
    	for (int j = m - 1; j >= 0; j--) {
    		
    		if (s[i][j] == 'J') {
    			ans += (d[i][j] * p[i][j]);	
			}
			
		}
	}
    
    cout<<ans;
    
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 1236 KB Output is correct
6 Correct 1 ms 1236 KB Output is correct
7 Correct 1 ms 1108 KB Output is correct
8 Correct 2 ms 1236 KB Output is correct
9 Correct 1 ms 1236 KB Output is correct
10 Correct 1 ms 1108 KB Output is correct
11 Correct 2 ms 1236 KB Output is correct
12 Correct 1 ms 1264 KB Output is correct
13 Correct 1 ms 1108 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 1236 KB Output is correct
6 Correct 1 ms 1236 KB Output is correct
7 Correct 1 ms 1108 KB Output is correct
8 Correct 2 ms 1236 KB Output is correct
9 Correct 1 ms 1236 KB Output is correct
10 Correct 1 ms 1108 KB Output is correct
11 Correct 2 ms 1236 KB Output is correct
12 Correct 1 ms 1264 KB Output is correct
13 Correct 1 ms 1108 KB Output is correct
14 Correct 6 ms 7508 KB Output is correct
15 Correct 2 ms 3796 KB Output is correct
16 Correct 3 ms 4564 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 7 ms 8564 KB Output is correct
19 Correct 5 ms 8276 KB Output is correct
20 Correct 5 ms 8388 KB Output is correct
21 Correct 7 ms 8532 KB Output is correct
22 Correct 5 ms 8276 KB Output is correct
23 Correct 7 ms 8276 KB Output is correct
24 Correct 9 ms 8532 KB Output is correct
25 Correct 6 ms 8336 KB Output is correct
26 Correct 6 ms 8380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 1236 KB Output is correct
6 Correct 1 ms 1236 KB Output is correct
7 Correct 1 ms 1108 KB Output is correct
8 Correct 2 ms 1236 KB Output is correct
9 Correct 1 ms 1236 KB Output is correct
10 Correct 1 ms 1108 KB Output is correct
11 Correct 2 ms 1236 KB Output is correct
12 Correct 1 ms 1264 KB Output is correct
13 Correct 1 ms 1108 KB Output is correct
14 Correct 6 ms 7508 KB Output is correct
15 Correct 2 ms 3796 KB Output is correct
16 Correct 3 ms 4564 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 7 ms 8564 KB Output is correct
19 Correct 5 ms 8276 KB Output is correct
20 Correct 5 ms 8388 KB Output is correct
21 Correct 7 ms 8532 KB Output is correct
22 Correct 5 ms 8276 KB Output is correct
23 Correct 7 ms 8276 KB Output is correct
24 Correct 9 ms 8532 KB Output is correct
25 Correct 6 ms 8336 KB Output is correct
26 Correct 6 ms 8380 KB Output is correct
27 Correct 166 ms 150708 KB Output is correct
28 Correct 10 ms 19540 KB Output is correct
29 Correct 10 ms 13216 KB Output is correct
30 Correct 1 ms 724 KB Output is correct
31 Correct 128 ms 124608 KB Output is correct
32 Correct 120 ms 151060 KB Output is correct
33 Correct 105 ms 150672 KB Output is correct
34 Correct 156 ms 144624 KB Output is correct
35 Correct 113 ms 151152 KB Output is correct
36 Correct 114 ms 150728 KB Output is correct
37 Correct 167 ms 151244 KB Output is correct
38 Correct 82 ms 124076 KB Output is correct
39 Correct 78 ms 124056 KB Output is correct