Submission #886764

#TimeUsernameProblemLanguageResultExecution timeMemory
886764Maite_MoraleBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
216 ms160180 KiB
#include<bits/stdc++.h> #define F first #define S second #define MAX 3005 #define oo 1e18 #define mod 1000000007 #define fast_in ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);cout.setf(ios::fixed);cout.precision(0); using namespace std; typedef long long ll; #define pll pair<ll , ll> #define vll vector<ll> #define vvll vector<vll> #define vpll vector<pll> ll o[MAX][MAX],t[MAX][MAX],n,m; string s[MAX]; int main(){ fast_in cin>>n>>m; for(int i=0;i<n;i++){ cin>>s[i]; for(int j=m-1;j>=0;j--){ o[i][j]=o[i][j+1]; if(s[i][j]=='O')o[i][j]++; } } for(int j=m-1;j>=0;j--){ for(int i=n-1;i>=0;i--){ t[i][j]=t[i+1][j]; if(s[i][j]=='I')t[i][j]++; } }ll r=0; for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ if(s[i][j]=='J'){ r+=o[i][j]*t[i][j]; } } }cout<<r; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...