Submission #1319210

#TimeUsernameProblemLanguageResultExecution timeMemory
1319210michael12Bitaro the Brave (JOI19_ho_t1)C++20
100 / 100
208 ms82444 KiB
#include<bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define int long long
using namespace std;
const int maxn = 5e5;
const int inf = 1e18;
signed main() {
    int n, m;
    cin >> n >> m;
    string S[n];
    for(int i = 0; i < n; i++){
        cin >> S[i];
    }
    vector<int> T(n + 1), F(m + 1);
    vector<vector<int>> dp(n, vector<int>(m));
    int ans = 0;
    for(int i = n - 1; i >= 0; i--){
        for(int j = m - 1; j >= 0; j--){
            if(S[i][j] == 'J'){
                ans += T[i] * F[j];
            }
            else if(S[i][j] == 'O'){
                 T[i] += 1;
            }
            else{
                F[j] += 1;
            }

        }
    }
    cout << ans;

    

}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...