Submission #712786

#TimeUsernameProblemLanguageResultExecution timeMemory
712786Angus_YeungBitaro the Brave (JOI19_ho_t1)C++11
100 / 100
312 ms159268 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll n, m, ans, si[3010][3010], so[3010][3010]; char a[3010][3010]; int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(0); cin >> n >> m; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { cin >> a[i][j]; if (a[i][j] == 'O') { so[i][j]++; } else if (a[i][j] == 'I') { si[i][j]++; } so[i][j] += so[i][j-1]; si[i][j] += si[i-1][j]; } } ans = 0; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { if (a[i][j] == 'J') { ans += (so[i][m]-so[i][j])*(si[n][j]-si[i][j]); } } } cout << ans << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...