Submission #1000201

# Submission time Handle Problem Language Result Execution time Memory
1000201 2024-06-17T03:19:00 Z Icelast Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
198 ms 159344 KB
#include <iostream>
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll maxn = 2*1e5+5, INF = 4e18+9;
void solve(){
    int n, m;
    cin >> n >> m;
    vector<string> s(n+1);
    for(int i = 1; i <= n; i++){
        cin >> s[i];
        s[i] = ' ' + s[i];
    }
    vector<vector<ll>> orb(n+2, vector<ll>(m+2, 0)), ingot(n+2, vector<ll>(m+2, 0));
    for(int i = 1; i <= n; i++){
        for(int j = m; j >= 1; j--){
            orb[i][j] = orb[i][j+1];
            if(s[i][j] == 'O') orb[i][j]++;
        }
    }
    for(int j = 1; j <= m; j++){
        for(int i = n; i >= 1; i--){
            ingot[i][j] = ingot[i+1][j];
            if(s[i][j] == 'I') ingot[i][j]++;
        }
    }
    ll ans = 0;
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= m; j++){
            if(s[i][j] == 'J'){
                ans += orb[i][j+1]*ingot[i+1][j];
            }
        }
    }
    cout << ans;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 0 ms 604 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 604 KB Output is correct
13 Correct 0 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 0 ms 604 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 604 KB Output is correct
13 Correct 0 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 4956 KB Output is correct
19 Correct 3 ms 4700 KB Output is correct
20 Correct 4 ms 4824 KB Output is correct
21 Correct 5 ms 4956 KB Output is correct
22 Correct 4 ms 4700 KB Output is correct
23 Correct 3 ms 4700 KB Output is correct
24 Correct 5 ms 4980 KB Output is correct
25 Correct 3 ms 4696 KB Output is correct
26 Correct 4 ms 4700 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 604 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 1 ms 604 KB Output is correct
9 Correct 0 ms 604 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 604 KB Output is correct
13 Correct 0 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 4956 KB Output is correct
19 Correct 3 ms 4700 KB Output is correct
20 Correct 4 ms 4824 KB Output is correct
21 Correct 5 ms 4956 KB Output is correct
22 Correct 4 ms 4700 KB Output is correct
23 Correct 3 ms 4700 KB Output is correct
24 Correct 5 ms 4980 KB Output is correct
25 Correct 3 ms 4696 KB Output is correct
26 Correct 4 ms 4700 KB Output is correct
27 Correct 174 ms 150520 KB Output is correct
28 Correct 1 ms 1112 KB Output is correct
29 Correct 8 ms 11868 KB Output is correct
30 Correct 1 ms 860 KB Output is correct
31 Correct 125 ms 110916 KB Output is correct
32 Correct 142 ms 158340 KB Output is correct
33 Correct 145 ms 159044 KB Output is correct
34 Correct 156 ms 128592 KB Output is correct
35 Correct 160 ms 158292 KB Output is correct
36 Correct 154 ms 158800 KB Output is correct
37 Correct 198 ms 159344 KB Output is correct
38 Correct 107 ms 109980 KB Output is correct
39 Correct 94 ms 110416 KB Output is correct