Submission #101654

#TimeUsernameProblemLanguageResultExecution timeMemory
101654KCSCBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
473 ms88440 KiB
#include <bits/stdc++.h> using namespace std; const int DIM = 3005; char mat[DIM][DIM]; int psm1[DIM][DIM], psm2[DIM][DIM]; int main(void) { #ifdef HOME freopen("brave.in", "r", stdin); freopen("brave.out", "w", stdout); #endif int n, m; cin >> n >> m; for (int i = 1; i <= n; ++i) { cin >> (mat[i] + 1); } long long ans = 0; for (int i = n; i >= 1; --i) { for (int j = m; j >= 1; --j) { psm1[i][j] = psm1[i][j + 1] + (mat[i][j] == 'O'); psm2[i][j] = psm2[i + 1][j] + (mat[i][j] == 'I'); if (mat[i][j] == 'J') { ans += psm1[i][j] * psm2[i][j]; } } } cout << ans << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...