Submission #747404

#TimeUsernameProblemLanguageResultExecution timeMemory
747404KongggwpBitaro the Brave (JOI19_ho_t1)C++14
20 / 100
21 ms8004 KiB
#include <bits/stdc++.h> using namespace std; const int MxN = 3005; int n , m , d[MxN][MxN] , r[MxN][MxN] , ans; char grid[MxN][MxN]; int main() { cin >> n >> m; for(int i=1 ; i<=n ; i++)for(int j=1 ; j<=m ; j++)cin >> grid[i][j]; for(int i=n ; i>=1 ; i--)for(int j=1 ; j<=m ; j++)d[i][j] = d[i+1][j] + (grid[i][j]=='I'); for(int i=1 ; i<=n ; i++)for(int j=m ; j>=1 ; j--)r[i][j] = r[i][j+1] + (grid[i][j]=='O'); for(int i=1 ; i<=n ; i++)for(int j=1 ; j<=m ; j++)if(grid[i][j]=='J')ans+=d[i][j]*r[i][j]; cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...