Submission #206964

#TimeUsernameProblemLanguageResultExecution timeMemory
206964joylintpBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
403 ms88448 KiB
#include<bits/stdc++.h> using namespace std; char mp[3000][3000]; int n, m, cc[2][3000][3000]; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> m; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) cin >> mp[i][j]; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) if (mp[i][j] == 'O') cc[0][i][j]++; else if (mp[i][j] == 'I') cc[1][i][j]++; else; for (int i = 0; i < n; i++) for (int j = m - 2; j >= 0; j--) cc[0][i][j] += cc[0][i][j + 1]; for (int j = 0; j < m; j++) for (int i = n - 2; i >= 0; i--) cc[1][i][j] += cc[1][i + 1][j]; long long ans = 0; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) if (mp[i][j] == 'J') ans += (long long)cc[0][i][j] * cc[1][i][j]; cout << ans << '\n'; return 0; } // * * ***** * * * * // * * * ** * * * // ***** ***** * * * * * // * * * * ** * * // * * ***** * * *** // ***** ***** * * * ***** * * ***** ***** // * * * * * * * ** * * * * // * * * ***** * * * * * * ***** // * * * * * * * * ** * * // **** ***** * ***** ***** * * * *
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...