Submission #774383

#TimeUsernameProblemLanguageResultExecution timeMemory
774383kirakaminski968Bitaro the Brave (JOI19_ho_t1)C++17
100 / 100
200 ms89528 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int H,W; cin >> H >> W; vector<string> grid(H); for(int i = 0;i<H;++i) cin >> grid[i]; vector<vector<int>> cntorbs(H,vector<int>(W,0)),cntingots(H,vector<int>(W,0)); for(int i = 0;i<H;++i){ int cnt = 0; for(int j = W-1;j>=0;--j){ if(grid[i][j] == 'O') cnt++; cntorbs[i][j] = cnt; } } for(int i = 0;i<W;++i){ int cnt = 0; for(int j = H-1;j>=0;--j){ if(grid[j][i] == 'I') cnt++; cntingots[j][i] = cnt; } } ll ans = 0; for(int i = 0;i<H;++i){ for(int j = 0;j<W;++j){ if(grid[i][j] == 'J') ans += cntorbs[i][j]*cntingots[i][j]; } } cout << ans << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...