Submission #913465

#TimeUsernameProblemLanguageResultExecution timeMemory
913465SadraMzfBitaro the Brave (JOI19_ho_t1)C++17
20 / 100
17 ms12124 KiB
#include <bits/stdc++.h> using namespace std; #define pt "--> " #define Fast() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) typedef long long int ll ; const int N = 3e3 + 7 , lg = 27 , len = 340 , Sq = 350 , oo = 2e9 , mod = 998244353 ; int dx[9] = {0 , -1 , 0 , 1 , 0 , 1 , 1 , -1 , -1} , dy[9] = {0 , 0 , -1 , 0 , 1 , 1 , -1 , 1 , -1} ; int n , m , ans ; int dp[N][N] , pd[N][N] ; char c[N][N] ; void solve() { cin >> n >> m ; for(int i = 1 ; i <= n ; i++) for(int j = 1 ; j <= m ; j++) cin >> c[i][j] ; for(int i = 1 ; i <= n ; i++) for(int j = m ; j ; j--) dp[i][j] = dp[i][j+1] + (c[i][j] == 'O') ; for(int j = 1 ; j <= m ; j++) for(int i = n ; i ; i--) pd[i][j] = pd[i+1][j] + (c[i][j] == 'I') ; for(int i = 1 ; i <= n ; i++) for(int j = 1 ; j <= m ; j++) if(c[i][j] == 'J') ans += dp[i][j] * pd[i][j] ; cout << ans << endl ; } int main(){ // Fast() ; int T = 1 ; while(T--) solve() ; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...