Submission #670432

#TimeUsernameProblemLanguageResultExecution timeMemory
670432berrBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
319 ms159116 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int co[3005][3005], ci[3005][3005]; char gr[3005][3005]; signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); int n, m; cin>>n>>m; for(int i=0; i < n; i++){ for(int l=0; l < m; l++){ cin >> gr[i][l]; if(gr[i][l] == 'I'){ ci[i][l]++; } if(gr[i][l] == 'O'){ co[i][l]++; } } } for(int i=0; i<n; i++){ for(int l=m-2; l>=0; l--){ co[i][l]+=co[i][l+1]; } } for(int i=n-2; i>=0; i--){ for(int l=0; l<m; l++){ ci[i][l]+=ci[i+1][l]; } } int ans=0; for(int i=0; i<n; i++){ for(int l=0; l<m; l++){ if(gr[i][l]=='J') ans+=(co[i][l]*ci[i][l]); } } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...