Submission #677013

# Submission time Handle Problem Language Result Execution time Memory
677013 2023-01-02T06:08:51 Z rittin1 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
271 ms 88548 KB
#include <bits/stdc++.h>
using namespace std;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,m;
    cin >> n >> m;
    char arr[n+1][m+1];
    int pref1[n+1][m+1];
    int pref2[n+1][m+1];
    for(int i=0;i<=n;i++){
        for(int j=0;j<=m;j++){
            pref1[i][j]=0;
            pref2[i][j]=0;
        }
    }
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            cin >> arr[i][j];
            pref1[i][j]=pref1[i][j-1];
            pref2[i][j]=pref2[i-1][j];
            if(arr[i][j]=='O'){
                pref1[i][j]=pref1[i][j-1]+1;
            }
            if(arr[i][j]=='I'){
                pref2[i][j]=pref2[i-1][j]+1;
            }
        }
    }
    long long ans=0;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(arr[i][j]=='J'){
                ans+=((pref1[i][m]-pref1[i][j])*(pref2[n][j]-pref2[i][j]));
            }
        }
    }
    cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 6 ms 2200 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 3 ms 1572 KB Output is correct
17 Correct 1 ms 424 KB Output is correct
18 Correct 8 ms 2768 KB Output is correct
19 Correct 6 ms 2548 KB Output is correct
20 Correct 5 ms 2644 KB Output is correct
21 Correct 8 ms 2768 KB Output is correct
22 Correct 7 ms 2644 KB Output is correct
23 Correct 6 ms 2644 KB Output is correct
24 Correct 8 ms 2760 KB Output is correct
25 Correct 7 ms 2676 KB Output is correct
26 Correct 5 ms 2720 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 6 ms 2200 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 3 ms 1572 KB Output is correct
17 Correct 1 ms 424 KB Output is correct
18 Correct 8 ms 2768 KB Output is correct
19 Correct 6 ms 2548 KB Output is correct
20 Correct 5 ms 2644 KB Output is correct
21 Correct 8 ms 2768 KB Output is correct
22 Correct 7 ms 2644 KB Output is correct
23 Correct 6 ms 2644 KB Output is correct
24 Correct 8 ms 2760 KB Output is correct
25 Correct 7 ms 2676 KB Output is correct
26 Correct 5 ms 2720 KB Output is correct
27 Correct 261 ms 83500 KB Output is correct
28 Correct 1 ms 596 KB Output is correct
29 Correct 14 ms 6668 KB Output is correct
30 Correct 1 ms 468 KB Output is correct
31 Correct 195 ms 61384 KB Output is correct
32 Correct 220 ms 87832 KB Output is correct
33 Correct 177 ms 88172 KB Output is correct
34 Correct 230 ms 71244 KB Output is correct
35 Correct 223 ms 87836 KB Output is correct
36 Correct 175 ms 88044 KB Output is correct
37 Correct 271 ms 88548 KB Output is correct
38 Correct 134 ms 61000 KB Output is correct
39 Correct 125 ms 61160 KB Output is correct