Submission #938153

#TimeUsernameProblemLanguageResultExecution timeMemory
938153LittleOrangeBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
326 ms160648 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(0);cin.tie(0); ll h,w; cin >> h >> w; vector<string> a(h); for(auto &o : a) cin >> o; vector<vector<ll>> b(h,vector<ll>(w,0)),c(h,vector<ll>(w,0)); ll ans = 0; for(ll j = w-1;j>=0;j--){ for(ll i = h-1;i>=0;i--){ if (a[i][j]=='O') b[i][j]++; if (j<w-1) b[i][j]+=b[i][j+1]; if (a[i][j]=='I') c[i][j]++; if (i<h-1) c[i][j]+=c[i+1][j]; if (a[i][j]=='J') ans += b[i][j]*c[i][j]; } } cout << ans << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...