제출 #1320224

#제출 시각아이디문제언어결과실행 시간메모리
1320224yessimkhanBitaro the Brave (JOI19_ho_t1)C++20
100 / 100
322 ms150388 KiB
#include <bits/stdc++.h> // solved by bekagg #define int long long #define ent '\n' #define pb push_back #define all(x) x.begin(),x.end() #define PRaim_bek_abi ios_base::sync_with_stdio(0);cin.tie(0); using namespace std; const int N = 3e3+5; const int MOD = 1e9+7; int n , m , c[N][N][2]; char a[N][N]; void arkanefury228(){ cin >> n >> m; for (int i = 1; i <= n; i++){ for (int j = 1; j <= m; j++) cin >> a[i][j]; } for (int j = 1; j <= m; j++){ int cnt = 0; for (int i = n; i >= 1; i--){ if (a[i][j] == 'I') cnt++; c[i][j][0] = cnt; } } for (int i = 1; i <= n; i++){ int cnt = 0; for (int j = m; j >= 1; j--){ if (a[i][j] == 'O') cnt++; c[i][j][1] = cnt; } } int ans = 0; for (int i = 1; i <= n; i++){ for (int j = 1; j <= m; j++){ if (a[i][j] == 'J') ans += c[i][j][0] * c[i][j][1]; } } cout << ans; } signed main(){ PRaim_bek_abi int t=1; //cin>>t; for (int respagold = 1; respagold <= t; respagold++) arkanefury228(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...