Submission #160527

#TimeUsernameProblemLanguageResultExecution timeMemory
160527dantoh000Bitaro the Brave (JOI19_ho_t1)C++14
100 / 100
92 ms10232 KiB
#include <bits/stdc++.h>
using namespace std;
int ct[3000];
int n,m;
string s[3000];
long long ans;
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> m;
    for (int i = 0; i < n; i++){
        cin >> s[i];
    }
    for (int i = n-1; i >= 0; i--){
        for (int j = m-1, ct2 = 0; j >= 0; j--){
            if (s[i][j] == 'O') ct2++;
            else if (s[i][j] == 'I') ct[j]++;
            else ans += ct[j]*ct2;
        }
    }
    cout << ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...