답안 #1018126

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1018126 2024-07-09T14:59:04 Z ag_1204 Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
167 ms 158736 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define pii pair<int,int>
#define vi vector<int>
#define si set<int>
#define pb push_back
 
void solve() {
    int n,m;
    cin>>n>>m;
    char grid[n][m];
    for(int i = 0;i < n;i++){
        for(int j = 0;j < m;j++){
            cin>>grid[i][j];
        }
    }
    int ans = 0;
    int a[n][m],b[n][m];
    for(int i = n - 1;i >= 0;i--){
        for(int j = m - 1;j >= 0;j--){
            a[i][j] = (j == m - 1?0:a[i][j + 1]) + (grid[i][j] == 'O');
            b[i][j] = (i == n - 1?0:b[i + 1][j]) + (grid[i][j] == 'I');
            if(grid[i][j] == 'J')ans+=a[i][j]*b[i][j];
        }
    }
    cout<<ans;
    return;
}
 
int32_t main() {
	ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int tt=1; //cin>>tt;
	while(tt--) {
	    solve();
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 456 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 464 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 604 KB Output is correct
8 Correct 0 ms 604 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 604 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 456 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 464 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 604 KB Output is correct
8 Correct 0 ms 604 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 604 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 604 KB Output is correct
14 Correct 4 ms 3676 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 2 ms 2652 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 5 ms 4696 KB Output is correct
19 Correct 5 ms 4504 KB Output is correct
20 Correct 4 ms 4700 KB Output is correct
21 Correct 5 ms 4728 KB Output is correct
22 Correct 4 ms 4444 KB Output is correct
23 Correct 4 ms 4764 KB Output is correct
24 Correct 7 ms 4652 KB Output is correct
25 Correct 4 ms 4444 KB Output is correct
26 Correct 4 ms 4772 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 456 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 464 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 604 KB Output is correct
8 Correct 0 ms 604 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 604 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 604 KB Output is correct
14 Correct 4 ms 3676 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 2 ms 2652 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 5 ms 4696 KB Output is correct
19 Correct 5 ms 4504 KB Output is correct
20 Correct 4 ms 4700 KB Output is correct
21 Correct 5 ms 4728 KB Output is correct
22 Correct 4 ms 4444 KB Output is correct
23 Correct 4 ms 4764 KB Output is correct
24 Correct 7 ms 4652 KB Output is correct
25 Correct 4 ms 4444 KB Output is correct
26 Correct 4 ms 4772 KB Output is correct
27 Correct 154 ms 150100 KB Output is correct
28 Correct 1 ms 856 KB Output is correct
29 Correct 11 ms 11612 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 108 ms 110292 KB Output is correct
32 Correct 140 ms 157780 KB Output is correct
33 Correct 138 ms 158288 KB Output is correct
34 Correct 149 ms 127964 KB Output is correct
35 Correct 152 ms 157776 KB Output is correct
36 Correct 151 ms 158288 KB Output is correct
37 Correct 167 ms 158736 KB Output is correct
38 Correct 100 ms 109404 KB Output is correct
39 Correct 104 ms 109904 KB Output is correct