Submission #654007

#TimeUsernameProblemLanguageResultExecution timeMemory
654007sofija6Bitaro the Brave (JOI19_ho_t1)C++14
100 / 100
400 ms159260 KiB
#include <bits/stdc++.h> #define ll long long #define MAXH 3010 using namespace std; char c[MAXH][MAXH]; ll cnto[MAXH][MAXH],cnti[MAXH][MAXH]; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); ll h,w,ans=0; cin >> h >> w; for (ll i=1;i<=h;i++) { for (ll j=1;j<=w;j++) cin >> c[i][j]; } for (ll i=1;i<=h;i++) { for (ll j=w;j>=1;j--) cnto[i][j]=cnto[i][j+1]+(c[i][j]=='O'); } for (ll j=1;j<=w;j++) { for (ll i=h;i>=1;i--) { cnti[i][j]=cnti[i+1][j]+(c[i][j]=='I'); if (c[i][j]=='J') ans+=cnto[i][j]*cnti[i][j]; } } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...