Submission #498269

# Submission time Handle Problem Language Result Execution time Memory
498269 2021-12-24T18:06:44 Z beepbeepsheep Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
181 ms 221096 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define endl '\n'
typedef pair<ll,ll> ii;
const ll mod=1e9+7;
const ll maxn=3005;
const ll inf=1e15;

ll grid[maxn][maxn][3];
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll r,c;
    string s;
    cin>>r>>c;
    for (int i=1;i<=r;i++){
        cin>>s;
        for (int j=1;j<=c;j++){
            if (s[j-1]=='J') grid[i][j][2]=1;
            if (s[j-1]=='O') grid[i][j][0]=1;
            if (s[j-1]=='I') grid[i][j][1]=1;
        }
    }
    ll ans=0;
    for (int i=maxn-2;i>=0;i--){
        for (int j=maxn-2;j>=0;j--){
            grid[i][j][0]+=grid[i][j+1][0];
            grid[i][j][1]+=grid[i+1][j][1];
            ans+=grid[i][j][0]*grid[i][j][1]*grid[i][j][2];
        }
    }
    cout<<ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 138 ms 212220 KB Output is correct
2 Correct 147 ms 212176 KB Output is correct
3 Correct 152 ms 212164 KB Output is correct
4 Correct 135 ms 212220 KB Output is correct
5 Correct 143 ms 212240 KB Output is correct
6 Correct 137 ms 212208 KB Output is correct
7 Correct 136 ms 212292 KB Output is correct
8 Correct 140 ms 212336 KB Output is correct
9 Correct 156 ms 212164 KB Output is correct
10 Correct 133 ms 212272 KB Output is correct
11 Correct 143 ms 212232 KB Output is correct
12 Correct 149 ms 212192 KB Output is correct
13 Correct 136 ms 212292 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 138 ms 212220 KB Output is correct
2 Correct 147 ms 212176 KB Output is correct
3 Correct 152 ms 212164 KB Output is correct
4 Correct 135 ms 212220 KB Output is correct
5 Correct 143 ms 212240 KB Output is correct
6 Correct 137 ms 212208 KB Output is correct
7 Correct 136 ms 212292 KB Output is correct
8 Correct 140 ms 212336 KB Output is correct
9 Correct 156 ms 212164 KB Output is correct
10 Correct 133 ms 212272 KB Output is correct
11 Correct 143 ms 212232 KB Output is correct
12 Correct 149 ms 212192 KB Output is correct
13 Correct 136 ms 212292 KB Output is correct
14 Correct 136 ms 212424 KB Output is correct
15 Correct 144 ms 212212 KB Output is correct
16 Correct 141 ms 212480 KB Output is correct
17 Correct 134 ms 212200 KB Output is correct
18 Correct 141 ms 212536 KB Output is correct
19 Correct 141 ms 212440 KB Output is correct
20 Correct 138 ms 212516 KB Output is correct
21 Correct 137 ms 212504 KB Output is correct
22 Correct 138 ms 212536 KB Output is correct
23 Correct 135 ms 212476 KB Output is correct
24 Correct 141 ms 212544 KB Output is correct
25 Correct 135 ms 212420 KB Output is correct
26 Correct 138 ms 212504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 138 ms 212220 KB Output is correct
2 Correct 147 ms 212176 KB Output is correct
3 Correct 152 ms 212164 KB Output is correct
4 Correct 135 ms 212220 KB Output is correct
5 Correct 143 ms 212240 KB Output is correct
6 Correct 137 ms 212208 KB Output is correct
7 Correct 136 ms 212292 KB Output is correct
8 Correct 140 ms 212336 KB Output is correct
9 Correct 156 ms 212164 KB Output is correct
10 Correct 133 ms 212272 KB Output is correct
11 Correct 143 ms 212232 KB Output is correct
12 Correct 149 ms 212192 KB Output is correct
13 Correct 136 ms 212292 KB Output is correct
14 Correct 136 ms 212424 KB Output is correct
15 Correct 144 ms 212212 KB Output is correct
16 Correct 141 ms 212480 KB Output is correct
17 Correct 134 ms 212200 KB Output is correct
18 Correct 141 ms 212536 KB Output is correct
19 Correct 141 ms 212440 KB Output is correct
20 Correct 138 ms 212516 KB Output is correct
21 Correct 137 ms 212504 KB Output is correct
22 Correct 138 ms 212536 KB Output is correct
23 Correct 135 ms 212476 KB Output is correct
24 Correct 141 ms 212544 KB Output is correct
25 Correct 135 ms 212420 KB Output is correct
26 Correct 138 ms 212504 KB Output is correct
27 Correct 178 ms 220512 KB Output is correct
28 Correct 138 ms 212272 KB Output is correct
29 Correct 134 ms 212800 KB Output is correct
30 Correct 135 ms 212292 KB Output is correct
31 Correct 168 ms 218304 KB Output is correct
32 Correct 143 ms 220996 KB Output is correct
33 Correct 136 ms 220992 KB Output is correct
34 Correct 177 ms 219404 KB Output is correct
35 Correct 145 ms 220916 KB Output is correct
36 Correct 139 ms 220992 KB Output is correct
37 Correct 181 ms 221096 KB Output is correct
38 Correct 145 ms 218304 KB Output is correct
39 Correct 133 ms 218312 KB Output is correct