Submission #1098158

#TimeUsernameProblemLanguageResultExecution timeMemory
1098158serifefedartarBitaro the Brave (JOI19_ho_t1)C++17
20 / 100
6 ms6752 KiB
#include <bits/stdc++.h> using namespace std; #define fast ios::sync_with_stdio(0);cin.tie(0) typedef long long ll; #define f first #define s second #define LOGN 21 const ll MOD = 1e9 + 7; const ll MAXN = 3000 + 100; vector<string> grid; int toR[MAXN][MAXN], toD[MAXN][MAXN]; int main() { fast; int H, W; cin >> H >> W; grid = vector<string>(H+1); for (int i = 1; i <= H; i++) { cin >> grid[i]; grid[i] = "#" + grid[i]; } for (int i = 1; i <= H; i++) { for (int j = W; j >= 1; j--) toR[i][j] = toR[i][j+1] + (grid[i][j] == 'O'); } for (int i = 1; i <= W; i++) { for (int j = H; j >= 1; j--) toD[j][i] = toD[j+1][i] + (grid[j][i] == 'I'); } int ans = 0; for (int i = 1; i <= H; i++) { for (int j = 1; j <= W; j++) { if (grid[i][j] == 'J') ans += toR[i][j] * toD[i][j]; } } cout << ans << "\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...