Submission #782893

#TimeUsernameProblemLanguageResultExecution timeMemory
782893acatmeowmeowBitaro the Brave (JOI19_ho_t1)C++11
100 / 100
230 ms79880 KiB
#include <bits/stdc++.h> using namespace std; #define int long long const int N = 3e3 + 5; int n, m, arr[N][N], row[N][5], col[N][5]; signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin >> n >> m; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { char ch; cin >> ch; if (ch == 'J') arr[i][j] = 0; else if (ch == 'O') arr[i][j] = 1; else arr[i][j] = 2; } } int ans = 0; for (int i = n; i >= 1; i--) { for (int j = m; j >= 1; j--) { if (!arr[i][j]) ans += row[i][1]*col[j][2]; row[i][arr[i][j]]++; col[j][arr[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...