제출 #946720

#제출 시각아이디문제언어결과실행 시간메모리
946720irmuunBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
185 ms89432 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define ff first #define ss second #define all(s) s.begin(),s.end() #define rall(s) s.rbegin(),s.rend() int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ll h,w; cin>>h>>w; ll a[h][w]; string s[h]; for(ll i=0;i<h;i++){ cin>>s[i]; } for(ll i=0;i<h;i++){ ll cur=0; for(ll j=w-1;j>=0;j--){ if(s[i][j]=='O'){ cur++; } a[i][j]=cur; } } ll ans=0; for(ll j=0;j<w;j++){ ll cur=0; for(ll i=h-1;i>=0;i--){ if(s[i][j]=='I'){ cur++; } if(s[i][j]=='J'){ ans+=cur*a[i][j]; } } } cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...