Submission #1053957

#TimeUsernameProblemLanguageResultExecution timeMemory
1053957ArthuroWichBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
50 ms19112 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int void solve() { int n, m, ans = 0; cin >> n >> m; vector<int> ai(m, 0), aj(n, 0); vector<string> grid(n); for (auto &x : grid) { cin >> x; } for (int i = n-1; i >= 0; i--) { for (int j = m-1; j >= 0; j--) { if (grid[i][j] == 'J') { ans += aj[i]*ai[j]; } else if (grid[i][j] == 'O') { aj[i]++; } else if (grid[i][j] == 'I') { ai[j]++; } } } cout << ans << endl; } int32_t main() { ios::sync_with_stdio(0); cin.tie(0); int t; t = 1; while(t--) { solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...