Submission #99164

# Submission time Handle Problem Language Result Execution time Memory
99164 2019-03-01T09:18:16 Z dongwon0427 Bitaro the Brave (JOI19_ho_t1) C++11
100 / 100
271 ms 86864 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;


int n,m;
char A[3005][3005];
pii B[3005][3005];
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin>>n>>m;
    for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) cin>>A[i][j];
    for(int i=1;i<=n;i++) {
        for(int j=m;j>=1;j--) {
            B[i][j].first = B[i][j+1].first + (A[i][j] == 'O');
        }
    }
    for(int i=n;i>=1;i--) {
        for(int j=1;j<=m;j++) {
            B[i][j].second = B[i+1][j].second + (A[i][j] == 'I');
        }
    }
    ll ans = 0;
    for(int i=1;i<=n;i++) {
        for(int j=1;j<=m;j++) {
            if(A[i][j] == 'J') {
                ans += B[i][j].first * B[i][j].second;
            }
        }
    }
    cout<<ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 1152 KB Output is correct
6 Correct 3 ms 1152 KB Output is correct
7 Correct 3 ms 1024 KB Output is correct
8 Correct 3 ms 1152 KB Output is correct
9 Correct 3 ms 1152 KB Output is correct
10 Correct 3 ms 1024 KB Output is correct
11 Correct 3 ms 1152 KB Output is correct
12 Correct 3 ms 1152 KB Output is correct
13 Correct 3 ms 1024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 1152 KB Output is correct
6 Correct 3 ms 1152 KB Output is correct
7 Correct 3 ms 1024 KB Output is correct
8 Correct 3 ms 1152 KB Output is correct
9 Correct 3 ms 1152 KB Output is correct
10 Correct 3 ms 1024 KB Output is correct
11 Correct 3 ms 1152 KB Output is correct
12 Correct 3 ms 1152 KB Output is correct
13 Correct 3 ms 1024 KB Output is correct
14 Correct 11 ms 5504 KB Output is correct
15 Correct 6 ms 3328 KB Output is correct
16 Correct 7 ms 3328 KB Output is correct
17 Correct 3 ms 512 KB Output is correct
18 Correct 13 ms 5988 KB Output is correct
19 Correct 12 ms 5888 KB Output is correct
20 Correct 13 ms 5888 KB Output is correct
21 Correct 13 ms 6016 KB Output is correct
22 Correct 11 ms 5888 KB Output is correct
23 Correct 11 ms 5932 KB Output is correct
24 Correct 14 ms 6012 KB Output is correct
25 Correct 12 ms 5888 KB Output is correct
26 Correct 12 ms 5888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 3 ms 1152 KB Output is correct
6 Correct 3 ms 1152 KB Output is correct
7 Correct 3 ms 1024 KB Output is correct
8 Correct 3 ms 1152 KB Output is correct
9 Correct 3 ms 1152 KB Output is correct
10 Correct 3 ms 1024 KB Output is correct
11 Correct 3 ms 1152 KB Output is correct
12 Correct 3 ms 1152 KB Output is correct
13 Correct 3 ms 1024 KB Output is correct
14 Correct 11 ms 5504 KB Output is correct
15 Correct 6 ms 3328 KB Output is correct
16 Correct 7 ms 3328 KB Output is correct
17 Correct 3 ms 512 KB Output is correct
18 Correct 13 ms 5988 KB Output is correct
19 Correct 12 ms 5888 KB Output is correct
20 Correct 13 ms 5888 KB Output is correct
21 Correct 13 ms 6016 KB Output is correct
22 Correct 11 ms 5888 KB Output is correct
23 Correct 11 ms 5932 KB Output is correct
24 Correct 14 ms 6012 KB Output is correct
25 Correct 12 ms 5888 KB Output is correct
26 Correct 12 ms 5888 KB Output is correct
27 Correct 236 ms 86864 KB Output is correct
28 Correct 20 ms 16896 KB Output is correct
29 Correct 18 ms 7808 KB Output is correct
30 Correct 2 ms 640 KB Output is correct
31 Correct 186 ms 71800 KB Output is correct
32 Correct 237 ms 86392 KB Output is correct
33 Correct 222 ms 86056 KB Output is correct
34 Correct 207 ms 83320 KB Output is correct
35 Correct 212 ms 86264 KB Output is correct
36 Correct 233 ms 86008 KB Output is correct
37 Correct 271 ms 86380 KB Output is correct
38 Correct 160 ms 71548 KB Output is correct
39 Correct 201 ms 71548 KB Output is correct