Submission #753091

#TimeUsernameProblemLanguageResultExecution timeMemory
753091CdSBitaro the Brave (JOI19_ho_t1)C++17
20 / 100
20 ms7636 KiB
#include <bits/stdc++.h> using namespace std; int orbes[3010][3010]; int ingots[3010][3010]; char grid[3010][3010]; int main() { int h, w; cin >> h >> w; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { cin >> grid[i][j]; } } for (int i = 0; i < h; i++) { for (int j = w; j >= 0; j--) { orbes[i][j] = orbes[i][j+1] + (grid[i][j] == 'O'); } } for (int j = 0; j < w; j++) { for (int i = h; i >= 0; i--) { ingots[i][j] = ingots[i+1][j] + (grid[i][j] == 'I'); } } int ans = 0; for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { if (grid[i][j] == 'J') { ans += ingots[i][j] * orbes[i][j]; } } } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...