답안 #381348

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
381348 2021-03-25T06:46:03 Z jlallas384 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
286 ms 56044 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    int n,m;
    cin >> n >> m;
    vector<string> g(n);
    for(auto &x: g){
        cin >> x;
    }
    vector<vector<int>> cnt(n+1,vector<int>(m));
    for(int i = n - 1; i >= 0; i--){
        for(int j = 0; j < m; j++){
            cnt[i][j] = cnt[i+1][j] + (g[i][j] == 'I');
        }
    }
    ll ans = 0;
    for(int i = 0; i < n; i++){
        int c = 0;
        for(int j = 0; j < m; j++){
            if(g[i][j] == 'J') c += cnt[i+1][j];
            if(g[i][j] == 'O') ans += c;
        }
    }
    cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 2 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 2 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 8 ms 1644 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 5 ms 1260 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 9 ms 2048 KB Output is correct
19 Correct 8 ms 1772 KB Output is correct
20 Correct 8 ms 2028 KB Output is correct
21 Correct 9 ms 2028 KB Output is correct
22 Correct 8 ms 1772 KB Output is correct
23 Correct 9 ms 2028 KB Output is correct
24 Correct 9 ms 2028 KB Output is correct
25 Correct 8 ms 1772 KB Output is correct
26 Correct 8 ms 2156 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 2 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 1 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 8 ms 1644 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 5 ms 1260 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 9 ms 2048 KB Output is correct
19 Correct 8 ms 1772 KB Output is correct
20 Correct 8 ms 2028 KB Output is correct
21 Correct 9 ms 2028 KB Output is correct
22 Correct 8 ms 1772 KB Output is correct
23 Correct 9 ms 2028 KB Output is correct
24 Correct 9 ms 2028 KB Output is correct
25 Correct 8 ms 1772 KB Output is correct
26 Correct 8 ms 2156 KB Output is correct
27 Correct 262 ms 53356 KB Output is correct
28 Correct 2 ms 620 KB Output is correct
29 Correct 19 ms 4460 KB Output is correct
30 Correct 2 ms 492 KB Output is correct
31 Correct 193 ms 40556 KB Output is correct
32 Correct 244 ms 55532 KB Output is correct
33 Correct 246 ms 55788 KB Output is correct
34 Correct 225 ms 47084 KB Output is correct
35 Correct 243 ms 55788 KB Output is correct
36 Correct 243 ms 55824 KB Output is correct
37 Correct 286 ms 56044 KB Output is correct
38 Correct 173 ms 40428 KB Output is correct
39 Correct 172 ms 40556 KB Output is correct