Submission #968450

#TimeUsernameProblemLanguageResultExecution timeMemory
968450tsetBitaro the Brave (JOI19_ho_t1)C++14
0 / 100
1 ms348 KiB
#include<bits/stdc++.h> using namespace std; #define int long long signed main() { int nbLigs, nbCols; cin >> nbLigs >> nbCols; vector<string> tab(nbLigs); for(int iL =0; iL < nbLigs; iL++) { cin >>tab[iL]; } vector<vector<int>>cumulBotToTop(nbLigs+1, vector<int>(nbCols+1, 0)); vector<vector<int>>cumulRightToLeft(nbLigs+1, vector<int>(nbCols+1, 0)); for(int iL = nbLigs-1; iL >=0; iL--) { for(int iC = nbCols-1; iC >= 0; iC--) { cumulRightToLeft[iL][iC] = cumulRightToLeft[iL][iC+1]; if(tab[iL][iC] == 'O') cumulRightToLeft[iL][iC]++; } } for(int iC = nbCols-1; iC >= 0; iC--) { for(int iL = nbLigs-1; iL >=0; iL--) { cumulBotToTop[iL][iC] = cumulBotToTop[iL+1][iC]; if(tab[iL][iC] == 'I') cumulBotToTop[iL][iC]++; } } int ans = 0; for(int iL = 0; iL < nbLigs; iL++) { for(int iC = 0; iC < nbCols; iC++) { if(tab[iL][iC] == 'J') { ans += cumulBotToTop[iL][iC] * cumulBotToTop[iL][iC]; } } } printf("%lld\n", ans); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...