Submission #242359

#TimeUsernameProblemLanguageResultExecution timeMemory
242359michaoBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
301 ms88568 KiB
#include <bits/stdc++.h> #define ll long long int #define mp make_pair #define pb push_back #define ld long double #define pii pair<int,int> #define sz(x) (int)x.size() #define piii pair<pii,pii> #define precise cout<<fixed<<setprecision(10) #define st first #define nd second #define ins insert #define vi vector<int> #define BOOST ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0) using namespace std; ll ans=0; const int MAX=3005; char tab[MAX][MAX]; int sufo[MAX][MAX]; int sufi[MAX][MAX]; int32_t main() { BOOST; int n,m; cin>>n>>m; for (int i=1;i<=n;i++) for(int j=1;j<=m;j++) cin>>tab[i][j]; for (int i=1;i<=n;i++) for (int j=m;j>=1;j--) sufo[i][j]=sufo[i][j+1]+(tab[i][j]=='O'); for (int i=1;i<=m;i++) for (int j=n;j>=1;j--) sufi[i][j]=sufi[i][j+1]+(tab[j][i]=='I'); for (int i=1;i<=n;i++) for (int j=1;j<=m;j++) if (tab[i][j]=='J') ans+=(ll)sufo[i][j]*sufi[j][i]; cout<<ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...