Submission #377891

#TimeUsernameProblemLanguageResultExecution timeMemory
377891astoriaBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
329 ms150764 KiB
#include "bits/stdc++.h" using namespace std; #define int long long int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int h,w; cin>>h>>w; char g[h+5][w+5]; for(int i=1; i<=h; i++){ for(int j=1; j<=w; j++){ cin>>g[i][j]; } } int so[h+5][w+5], si[h+5][w+5]; memset(so,0,sizeof(so)); memset(si,0,sizeof(si)); //Orb: sec is higher; Ingot: fst is higher for(int i=1; i<=h; i++){ for(int j=w; j>=1; j--){ so[i][j] = so[i][j+1]; if(g[i][j]=='O') so[i][j]++; } } for(int i=h; i>=1; i--){ for(int j=1; j<=w; j++){ si[i][j]=si[i+1][j]; if(g[i][j]=='I') si[i][j]++; } } int an=0; for(int i=1; i<=h; i++){ for(int j=1; j<=w; j++){ if(g[i][j]=='J') an += (so[i][j]*si[i][j]); } } cout<<an; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...