제출 #642896

#제출 시각아이디문제언어결과실행 시간메모리
642896kdn5549Bitaro the Brave (JOI19_ho_t1)C++17
100 / 100
325 ms159068 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pi; typedef pair<ll,ll> pl; #define eb emplace_back #define all(v) v.begin(),v.end() #define ff first #define ss second const ll mxn=3005; char a[mxn][mxn]; ll on[mxn][mxn],in[mxn][mxn]; int main() { ios::sync_with_stdio(0); cin.tie(0); ll h,w; cin>>h>>w; for (int i=1;i<=h;i++) { for (int j=1;j<=w;j++) { cin>>a[i][j]; if (a[i][j]=='O') on[i][j]++; if (a[i][j]=='I') in[i][j]++; } } for (int i=1;i<=h;i++) for(int j=1;j<=w;j++) { on[i][j]+=on[i][j-1]; in[i][j]+=in[i-1][j]; } ll rt=0; for (int i=1;i<=h;i++) for (int j=1;j<=w;j++) if(a[i][j]=='J') { rt+=(on[i][w]-on[i][j])*(in[h][j]-in[i][j]); } cout<<rt; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...