Submission #544290

#TimeUsernameProblemLanguageResultExecution timeMemory
544290JomnoiBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
88 ms83396 KiB
#include <bits/stdc++.h> #define DEBUG 0 using namespace std; const int N = 3e3 + 10; char S[N][N]; int qsi[N][N], qso[N][N]; int main() { cin.tie(0)->sync_with_stdio(0); int H, W; cin >> H >> W; for(int i = 1; i <= H; i++) { cin >> (S[i] + 1); } for(int i = 1; i <= H; i++) { for(int j = 1; j <= W; j++) { qso[i][j] = qso[i][j - 1] + (S[i][j] == 'O'); qsi[i][j] = qsi[i - 1][j] + (S[i][j] == 'I'); } } long long ans = 0; for(int i = 1; i <= H; i++) { for(int j = 1; j <= W; j++) { ans += 1ll*(S[i][j] == 'J') * (qso[i][W] - qso[i][j]) * (qsi[H][j] - qsi[i][j]); } } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...