Submission #390701

# Submission time Handle Problem Language Result Execution time Memory
390701 2021-04-16T15:37:00 Z wildturtle Bitaro the Brave (JOI19_ho_t1) C++14
100 / 100
623 ms 185600 KB
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll a,b,c,d,i,e,f,g,n,m,k,l,ans;
ll A[5003][5003],B[5003][5003];
string s[5003];
int main() {
    cin>>n>>m;
    for(ll i=1;i<=n;i++) {
        cin>>s[i];
        a=0;
        for(ll j=m-1;j>=0;j--) {
            if(s[i][j]=='O') { a++; }
            A[i][j]=a;
        }
    }
    for(ll i=0;i<m;i++) {
        a=0;
        for(ll j=n;j>=1;j--) {
            if(s[j][i]=='I') a++;
            B[j][i]=a;
        }
    }
    for(ll i=1;i<=n;i++) {
        for(ll j=0;j<m;j++) {
            if(s[i][j]=='J') { ans+=A[i][j]*B[i][j]; }
        }
    }
    cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 460 KB Output is correct
2 Correct 1 ms 460 KB Output is correct
3 Correct 1 ms 460 KB Output is correct
4 Correct 1 ms 460 KB Output is correct
5 Correct 2 ms 1356 KB Output is correct
6 Correct 1 ms 1356 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1356 KB Output is correct
9 Correct 1 ms 1356 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 2 ms 1356 KB Output is correct
12 Correct 1 ms 1356 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 460 KB Output is correct
2 Correct 1 ms 460 KB Output is correct
3 Correct 1 ms 460 KB Output is correct
4 Correct 1 ms 460 KB Output is correct
5 Correct 2 ms 1356 KB Output is correct
6 Correct 1 ms 1356 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1356 KB Output is correct
9 Correct 1 ms 1356 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 2 ms 1356 KB Output is correct
12 Correct 1 ms 1356 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
14 Correct 12 ms 7896 KB Output is correct
15 Correct 3 ms 3916 KB Output is correct
16 Correct 7 ms 4940 KB Output is correct
17 Correct 1 ms 588 KB Output is correct
18 Correct 16 ms 9164 KB Output is correct
19 Correct 12 ms 8652 KB Output is correct
20 Correct 11 ms 8908 KB Output is correct
21 Correct 14 ms 9164 KB Output is correct
22 Correct 12 ms 8744 KB Output is correct
23 Correct 11 ms 8908 KB Output is correct
24 Correct 14 ms 9164 KB Output is correct
25 Correct 12 ms 8680 KB Output is correct
26 Correct 11 ms 8908 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 460 KB Output is correct
2 Correct 1 ms 460 KB Output is correct
3 Correct 1 ms 460 KB Output is correct
4 Correct 1 ms 460 KB Output is correct
5 Correct 2 ms 1356 KB Output is correct
6 Correct 1 ms 1356 KB Output is correct
7 Correct 1 ms 1356 KB Output is correct
8 Correct 1 ms 1356 KB Output is correct
9 Correct 1 ms 1356 KB Output is correct
10 Correct 1 ms 1356 KB Output is correct
11 Correct 2 ms 1356 KB Output is correct
12 Correct 1 ms 1356 KB Output is correct
13 Correct 1 ms 1356 KB Output is correct
14 Correct 12 ms 7896 KB Output is correct
15 Correct 3 ms 3916 KB Output is correct
16 Correct 7 ms 4940 KB Output is correct
17 Correct 1 ms 588 KB Output is correct
18 Correct 16 ms 9164 KB Output is correct
19 Correct 12 ms 8652 KB Output is correct
20 Correct 11 ms 8908 KB Output is correct
21 Correct 14 ms 9164 KB Output is correct
22 Correct 12 ms 8744 KB Output is correct
23 Correct 11 ms 8908 KB Output is correct
24 Correct 14 ms 9164 KB Output is correct
25 Correct 12 ms 8680 KB Output is correct
26 Correct 11 ms 8908 KB Output is correct
27 Correct 582 ms 177212 KB Output is correct
28 Correct 11 ms 19788 KB Output is correct
29 Correct 26 ms 14296 KB Output is correct
30 Correct 2 ms 844 KB Output is correct
31 Correct 430 ms 133900 KB Output is correct
32 Correct 572 ms 184696 KB Output is correct
33 Correct 553 ms 184956 KB Output is correct
34 Correct 518 ms 155376 KB Output is correct
35 Correct 563 ms 184624 KB Output is correct
36 Correct 548 ms 184872 KB Output is correct
37 Correct 623 ms 185600 KB Output is correct
38 Correct 405 ms 133232 KB Output is correct
39 Correct 379 ms 133548 KB Output is correct