제출 #383096

#제출 시각아이디문제언어결과실행 시간메모리
383096MODDIBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
473 ms84560 KiB
#include <bits/stdc++.h> #define ll long long #define pii pair<int,int> #define pll pair<ll,ll> #define vi vector<int> #define vl vector<ll> #define mp make_pair #define pb push_back using namespace std; ll n, m, rez = 0; char mat[3030][3030]; int main(){ cin>>n>>m; for(int i = 0; i < n; i++){ string a; cin>>a; for(int j = 0; j < m; j++){ mat[i][j] = a[j]; } } int row[n][m], col[n][m]; memset(row,0,sizeof(row)); for(int i = 0; i < n;i++){ int cur = 0; for(int j = m - 1; j >= 0; j--){ if(mat[i][j]=='O') cur++; row[i][j] = cur; } } memset(col,0,sizeof(col)); for(int j = 0; j < m; j++){ int cur = 0; for(int i = n - 1; i >= 0; i--){ if(mat[i][j] == 'I') cur++; col[i][j] = cur; } } for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ if(mat[i][j] == 'J' && i + 1 < n && j + 1 < m){ ll lcnt = row[i][j+1], kcnt = col[i + 1][j]; rez += (kcnt * lcnt); } else continue; } } cout<<rez<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...