Submission #1226692

#TimeUsernameProblemLanguageResultExecution timeMemory
1226692wedonttalkanymoreBitaro the Brave (JOI19_ho_t1)C++20
0 / 100
0 ms324 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; const int N = 5005; int h, w; int a[N][N]; int col_pfs[N][N][3]; // prefix sum theo cột signed main() { cin >> h >> w; for (int i = 1; i <= h; i++) { string s; cin >> s; for (int j = 1; j <= w; j++) { if (s[j - 1] == 'J') a[i][j] = 0; else if (s[j - 1] == 'O') a[i][j] = 1; else a[i][j] = 2; } } for (int j = 1; j <= w; j++) { for (int i = 1; i <= h; i++) { for (int k = 0; k < 3; k++) { col_pfs[i][j][k] = col_pfs[i - 1][j][k]; if (a[i][j] == k) col_pfs[i][j][k]++; } } } ll ans = 0; for (int i = 1; i <= h; i++) { for (int k = i + 2; k <= h; k++) { for (int j = 1; j <= w; j++) { if (a[i][j] == 0 && a[k][j] == 2) { int cntO = col_pfs[k - 1][j][1] - col_pfs[i][j][1]; ans += cntO; } } } } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...