Submission #465111

#TimeUsernameProblemLanguageResultExecution timeMemory
465111okaragulBitaro the Brave (JOI19_ho_t1)C++17
20 / 100
20 ms1788 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define endl "\n" #define all(aa) aa.begin(), aa.end() int main(){ int n, m; cin>>n>>m; vector<vector<char>> mat(n, vector<char>(m)); vector<vector<int>> below(n, vector<int>(m)); for(auto &r:mat) for(auto &e:r) cin>>e; for(int j = 0; j < m; j++) for(int i = n-1; i >= 0; i--) below[i][j]=below[min(n-1, i+1)][j]+(mat[i][j]=='I'); int ans=0; for(int i = 0; i < n; i++){ int cur=0; for(int j = m-1; j >= 0; j--) ans+=(mat[i][j]=='J')*(cur+=(mat[i][j]=='O'))*below[i][j]; } cout<<ans<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...