Submission #1315494

#TimeUsernameProblemLanguageResultExecution timeMemory
1315494AgageldiBitaro the Brave (JOI19_ho_t1)C++20
20 / 100
1096 ms16288 KiB
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define N 500005

int tc = 1, n, a[N], ans, m;
string s[N];

int32_t main() {
    ios::sync_with_stdio(0);cin.tie(0);
    cin >> n >> m;
    for(int i = 1; i <= n; i++) {
        cin >> s[i];
        s[i] = '.' + s[i]; 
    }
    for(int i=1; i <= n; i++) {
        for(int j = 1; j <= m; j++) {
            if(s[i][j]=='J') {
                for(int l = j + 1; l <= m; l++) {
                    if(s[i][l] == 'O') {
                        for(int k = i + 1; k <= n; k++) {
                            if(s[k][j] == 'I') {
                                ans++;
                                // cout << i << " " << j << " " << k << " " << l << '\n';
                            }
                        }
                    }
                }
            }
        }
    }
    cout << ans << '\n';
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...