Submission #942034

#TimeUsernameProblemLanguageResultExecution timeMemory
942034carriewangBitaro the Brave (JOI19_ho_t1)C++17
20 / 100
5 ms11100 KiB
#include <bits/stdc++.h> #define ll long long #define vi vector<int> #define vl vector<ll> #define pii pair<int,int> #define pll pair<ll,ll> #define sz(x) x.size() #define all(x) x.begin(),x.end() #define F first #define S second using namespace std; const int maxn=3005; int h,w,a[maxn][maxn],b[maxn][maxn]; string s[maxn]; int main(){ ios::sync_with_stdio(0),cin.tie(0); cin >> h >> w; for(int i=0;i<h;i++){ cin >> s[i]; } int ans=0; for(int i=h-1;i>=0;i--){ for(int j=w-1;j>=0;j--){ a[i][j]=a[i+1][j]; b[i][j]=b[i][j+1]; if(s[i][j]=='I') a[i][j]++; else if(s[i][j]=='O') b[i][j]++; else ans+=a[i][j]*b[i][j]; } } cout << ans << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...