Submission #991159

#TimeUsernameProblemLanguageResultExecution timeMemory
991159aaaaaarrozBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
73 ms88968 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long; const int N = 3030; char c[N][N]; int qs[2][N][N]; int main() { cin.tie(nullptr)->sync_with_stdio(false); int n, m; cin >> n >> m; for (int i = 1;i <= n;i++) { cin >> (c[i] + 1); for (int j = 1;j <= m;j++) { qs[0][i][j] = qs[0][i][j - 1] + (c[i][j] == 'O'); qs[1][i][j] = qs[1][i - 1][j] + (c[i][j] == 'I'); } } ll ans = 0; for (int i = 1;i < n;i++) { for (int j = 1;j < m;j++) { if (c[i][j] == 'J') { ans += 1ll * (qs[0][i][m] - qs[0][i][j]) * (qs[1][n][j] - qs[1][i][j]); } } } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...