Submission #594193

#TimeUsernameProblemLanguageResultExecution timeMemory
594193VanillaBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
380 ms158992 KiB
#include <bits/stdc++.h> using namespace std; typedef long long int64; const int maxn = 3e3 + 2; string a [maxn]; int64 row [maxn][maxn], col[maxn][maxn]; int main() { int n,m; cin >> n >> m; for (int i = 1; i <= n; i++){ cin >> a[i]; a[i] = "#" + a[i]; for (int j = 1; j <= m; j++){ row[i][j] = row[i][j-1] + (a[i][j] == 'O'); } } for (int j = 1; j <= m; j++){ for (int i = 1; i <= n; i++){ col[j][i] = col[j][i-1] + (a[i][j] == 'I'); } } int64 rs = 0; for (int i = 1; i <= n; i++){ for (int j = 1; j <= m; j++){ // cout << i << " " << j << " " << (row[i][n] - row[i][j]) << " " << (col[j][n] - col[j][i]) << "\n"; if (a[i][j] == 'J') rs+=(row[i][m] - row[i][j]) * (col[j][n] - col[j][i]); } } cout << rs << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...