제출 #142877

#제출 시각아이디문제언어결과실행 시간메모리
142877ahmetBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
607 ms159060 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define rep(i,n) for(long long (i)=0;(i)<(n);++(i)) #define ref(i,a,b) for (long long (i)=(a); (i)<=(b); ++(i)) #define INF 0xFFFFFF #define endl '\n' #define pb push_back #define mp make_pair const unsigned int mod = 1e9+7; const int mx=1e5+5; ll h,w; char s[3001][3001]; ll row[3001][3001]; ll col[3001][3001]; int main(){ /*freopen("tavsan.gir", "r", stdin); freopen("tavsan.cik", "w", stdout); */ios_base::sync_with_stdio(false);cin.tie(NULL); cin >> h >> w; ref(i,1,h)ref(j,1,w)cin >> s[i][j]; ref(i,1,h){ for(ll j=w;j>=1;--j){ row[i][j]=row[i][j+1]+(s[i][j]=='O'); } } ref(i,1,w){ for(ll j=h;j>=1;--j){ col[j][i]=col[j+1][i]+(s[j][i]=='I'); } } ll ans=0; ref(i,1,h){ ref(j,1,w){ if(s[i][j]=='J'){ ans+=row[i][j+1]*col[i+1][j]; } } } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...