Submission #887578

#TimeUsernameProblemLanguageResultExecution timeMemory
887578Perl32Bitaro the Brave (JOI19_ho_t1)C++14
100 / 100
236 ms160464 KiB
// I wrote this code 4 u <3 #include <bits/stdc++.h> using namespace std; using ll = long long; #ifdef LOCAL #include "algo/debug.h" #else #define debug(...) 42 #endif signed main(int32_t argc, char *argv[]) { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n, m; cin >> n >> m; vector<string> a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; } vector<vector<ll>> prefX(m + 1, vector<ll>(n)), prefY(n + 1, vector<ll>(m)); for (int i = n - 1; i > -1; --i) { for (int j = m - 1; j > -1; --j) { prefX[j][i] = prefX[j + 1][i] + (a[i][j] == 'O'); prefY[i][j] = prefY[i + 1][j] + (a[i][j] == 'I'); } } ll ans = 0; for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { if (a[i][j] == 'J') { ans += prefX[j + 1][i] * prefY[i + 1][j]; } } } cout << ans; } /* */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...