Submission #1073396

# Submission time Handle Problem Language Result Execution time Memory
1073396 2024-08-24T14:01:56 Z RKHTM Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
126 ms 18004 KB
#include <bits/stdc++.h>
using namespace std;
#define yasuho ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
typedef long long ll;
const ll MOD = 1e9+7;

void solve(){
    ll r, c; cin >> r >> c;
    vector<vector<char>> grid(r+1, vector<char>(c+1));
    for(int i=1; i<=r; i++){
        for(int j=1; j<=c; j++){
            cin >> grid[i][j];
        }
    }

    vector<ll> ingot(c+1, 0);
    ll ans = 0;
    for(int i=r; i>=1; i--){
        ll orb=0;
        for(int j=c; j>=1; j--){
            if(grid[i][j]=='J'){
                // cout << ingot[j] << ' ' << orb << endl;
                ans += ingot[j]*orb;
            }
            if(grid[i][j]=='I') ingot[j]++;
            if(grid[i][j]=='O') orb++;
        }
    }

    cout << ans << endl;

    return;
}

int main(){
    yasuho // remove for interactive problem
    ll t;
    t = 1;
    //cin >> t;
    while(t--) solve();
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 600 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 416 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 600 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 416 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 3 ms 600 KB Output is correct
15 Correct 0 ms 464 KB Output is correct
16 Correct 1 ms 604 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 4 ms 860 KB Output is correct
19 Correct 3 ms 948 KB Output is correct
20 Correct 3 ms 860 KB Output is correct
21 Correct 4 ms 860 KB Output is correct
22 Correct 3 ms 720 KB Output is correct
23 Correct 3 ms 820 KB Output is correct
24 Correct 4 ms 856 KB Output is correct
25 Correct 2 ms 824 KB Output is correct
26 Correct 3 ms 820 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 600 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 416 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 3 ms 600 KB Output is correct
15 Correct 0 ms 464 KB Output is correct
16 Correct 1 ms 604 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 4 ms 860 KB Output is correct
19 Correct 3 ms 948 KB Output is correct
20 Correct 3 ms 860 KB Output is correct
21 Correct 4 ms 860 KB Output is correct
22 Correct 3 ms 720 KB Output is correct
23 Correct 3 ms 820 KB Output is correct
24 Correct 4 ms 856 KB Output is correct
25 Correct 2 ms 824 KB Output is correct
26 Correct 3 ms 820 KB Output is correct
27 Correct 126 ms 17188 KB Output is correct
28 Correct 1 ms 600 KB Output is correct
29 Correct 6 ms 1624 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 94 ms 13036 KB Output is correct
32 Correct 82 ms 18004 KB Output is correct
33 Correct 85 ms 18000 KB Output is correct
34 Correct 100 ms 14680 KB Output is correct
35 Correct 83 ms 18004 KB Output is correct
36 Correct 91 ms 18000 KB Output is correct
37 Correct 119 ms 18000 KB Output is correct
38 Correct 55 ms 12624 KB Output is correct
39 Correct 53 ms 12496 KB Output is correct