제출 #498269

#제출 시각아이디문제언어결과실행 시간메모리
498269beepbeepsheepBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
181 ms221096 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define endl '\n' typedef pair<ll,ll> ii; const ll mod=1e9+7; const ll maxn=3005; const ll inf=1e15; ll grid[maxn][maxn][3]; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); ll r,c; string s; cin>>r>>c; for (int i=1;i<=r;i++){ cin>>s; for (int j=1;j<=c;j++){ if (s[j-1]=='J') grid[i][j][2]=1; if (s[j-1]=='O') grid[i][j][0]=1; if (s[j-1]=='I') grid[i][j][1]=1; } } ll ans=0; for (int i=maxn-2;i>=0;i--){ for (int j=maxn-2;j>=0;j--){ grid[i][j][0]+=grid[i][j+1][0]; grid[i][j][1]+=grid[i+1][j][1]; ans+=grid[i][j][0]*grid[i][j][1]*grid[i][j][2]; } } cout<<ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...