Submission #364239

#TimeUsernameProblemLanguageResultExecution timeMemory
364239RainbowbunnyBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
240 ms88684 KiB
#include <iostream> #include <queue> #include <algorithm> #include <utility> #include <vector> int h, w; char board[3005][3005]; int countorb[3005][3005], countingot[3005][3005]; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0); std::cin >> h >> w; for(int i = 1; i <= h; i++) { for(int j = 1; j <= w; j++) { std::cin >> board[i][j]; countorb[i][j] = countorb[i][j - 1] + (board[i][j] == 'O'); countingot[i][j] = countingot[i - 1][j] + (board[i][j] == 'I'); } } long long ans = 0; for(int i = 1; i <= h; i++) { for(int j = 1; j <= w; j++) { if(board[i][j] == 'J') { ans += 1ll * (countorb[i][w] - countorb[i][j]) * (countingot[h][j] - countingot[i][j]); } } } std::cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...