Submission #1049586

# Submission time Handle Problem Language Result Execution time Memory
1049586 2024-08-09T00:15:52 Z vjudge1 Bitaro the Brave (JOI19_ho_t1) C++17
100 / 100
149 ms 161624 KB
#include <bits/stdc++.h>
using namespace std;
#define ll  long long
#define fi first
#define se second
#define sst string
#define pb push_back
#define maxco 100000+5
#define lld long double
#define cha ios_base::sync_with_stdio(false);
#define ffl cout.flush();
#define phi acos(-1)
#define mr make_pair
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define pqin priority_queue<ll,vector<ll>,greater<>>
#define pqpair priority_queue<pair<ll,ll> ,vector<pair<ll,ll>>,greater<pair<ll,ll>>>
#define pqpair2 priority_queue<pair<pair<ll,ll>,pair<ll,ll>>,vector<pair<pi,pair<ll,ll>>>,greater<pair<pi,pair<ll,ll>>>>
#define INF 1000000009
#define MAXN 1000006
#define pii pair<ll,ll>
 
#define mod 998244353


ll h,w;
sst s[3003];
ll ps1[3003][3003],ps2[3003][3003];

int main(){
    cin>>h>>w;
    REP(i,0,h-1)cin>>s[i];
    REP(i,0,h-1){
        REP(j,0,w-1){
            ll bci=max((ll)0,i-1ll);
            ll bcj=max((ll)0,j-1ll);
            ps2[i][j]+=ps2[i][bcj]+(s[i][j]=='O');
            ps1[i][j]+=ps1[bci][j]+(s[i][j]=='I');
        }
    }
    ll ans=0;
    REP(i,0,h-1){
        REP(j,0,w-1){
            if(s[i][j]=='J'){
                ans+=(ps1[h-1][j]-ps1[i][j])*(ps2[i][w-1]-ps2[i][j]);
            }
        }
    }
    cout<<ans<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 1 ms 3164 KB Output is correct
6 Correct 1 ms 3368 KB Output is correct
7 Correct 1 ms 3160 KB Output is correct
8 Correct 1 ms 3164 KB Output is correct
9 Correct 1 ms 3164 KB Output is correct
10 Correct 1 ms 3164 KB Output is correct
11 Correct 1 ms 3164 KB Output is correct
12 Correct 1 ms 3164 KB Output is correct
13 Correct 1 ms 3164 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 1 ms 3164 KB Output is correct
6 Correct 1 ms 3368 KB Output is correct
7 Correct 1 ms 3160 KB Output is correct
8 Correct 1 ms 3164 KB Output is correct
9 Correct 1 ms 3164 KB Output is correct
10 Correct 1 ms 3164 KB Output is correct
11 Correct 1 ms 3164 KB Output is correct
12 Correct 1 ms 3164 KB Output is correct
13 Correct 1 ms 3164 KB Output is correct
14 Correct 5 ms 18780 KB Output is correct
15 Correct 2 ms 12636 KB Output is correct
16 Correct 3 ms 9564 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
18 Correct 9 ms 19548 KB Output is correct
19 Correct 6 ms 19292 KB Output is correct
20 Correct 6 ms 17500 KB Output is correct
21 Correct 6 ms 19548 KB Output is correct
22 Correct 6 ms 19240 KB Output is correct
23 Correct 6 ms 17420 KB Output is correct
24 Correct 7 ms 19548 KB Output is correct
25 Correct 6 ms 19292 KB Output is correct
26 Correct 6 ms 17500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 1 ms 3164 KB Output is correct
6 Correct 1 ms 3368 KB Output is correct
7 Correct 1 ms 3160 KB Output is correct
8 Correct 1 ms 3164 KB Output is correct
9 Correct 1 ms 3164 KB Output is correct
10 Correct 1 ms 3164 KB Output is correct
11 Correct 1 ms 3164 KB Output is correct
12 Correct 1 ms 3164 KB Output is correct
13 Correct 1 ms 3164 KB Output is correct
14 Correct 5 ms 18780 KB Output is correct
15 Correct 2 ms 12636 KB Output is correct
16 Correct 3 ms 9564 KB Output is correct
17 Correct 1 ms 604 KB Output is correct
18 Correct 9 ms 19548 KB Output is correct
19 Correct 6 ms 19292 KB Output is correct
20 Correct 6 ms 17500 KB Output is correct
21 Correct 6 ms 19548 KB Output is correct
22 Correct 6 ms 19240 KB Output is correct
23 Correct 6 ms 17420 KB Output is correct
24 Correct 7 ms 19548 KB Output is correct
25 Correct 6 ms 19292 KB Output is correct
26 Correct 6 ms 17500 KB Output is correct
27 Correct 137 ms 161128 KB Output is correct
28 Correct 8 ms 63580 KB Output is correct
29 Correct 10 ms 15824 KB Output is correct
30 Correct 1 ms 2908 KB Output is correct
31 Correct 109 ms 133688 KB Output is correct
32 Correct 136 ms 161404 KB Output is correct
33 Correct 124 ms 161108 KB Output is correct
34 Correct 119 ms 157584 KB Output is correct
35 Correct 135 ms 161604 KB Output is correct
36 Correct 125 ms 161104 KB Output is correct
37 Correct 149 ms 161624 KB Output is correct
38 Correct 92 ms 133468 KB Output is correct
39 Correct 93 ms 133204 KB Output is correct