Submission #1258733

#TimeUsernameProblemLanguageResultExecution timeMemory
1258733nasufyroBitaro the Brave (JOI19_ho_t1)C++20
20 / 100
3 ms580 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); ll h, w; cin >> h >> w; vector<string> board(h); for(ll i = 0; i < h; i++){ cin >> board[i]; } ll ans=0; vector<ll> col(w, 0); vector<ll> suf(w, 0); for(ll i=0;i<h;i++) { for(ll j=0;j<w;j++) { if(board[i][j]=='I') { col[j]++; } } } for(ll i=0;i<h;i++) { for(ll j=0;j<w;j++) { if(board[i][j]=='I') { col[j]--; } } suf[w] = 0; for(ll j=w-1;j>=0;j--) { suf[j] = suf[j+1] + (board[i][j]=='O'); } for(ll j=0;j<w;j++) { if(board[i][j]=='J') { ans += col[j] * suf[j+1]; } } } cout<<ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...