Submission #1141215

#TimeUsernameProblemLanguageResultExecution timeMemory
1141215henriessBitaro the Brave (JOI19_ho_t1)C++20
0 / 100
0 ms324 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); long long h,w;cin >> h >> w; vector<vector<char>> g(h,vector<char>(w)); for(int i = 0;i<h;i++){ for(int j = 0;j<w;j++){ char c;cin >> c; g[i][j] = c; } } vector<long long> prefixsum(w); //prefixsum[i][j] = prefixsum at row i starting from column j long long ans = 0; for(int i = 1;i<h;i++){ long long trackO = 0; long long total = 0; for(int j = w-1;j>=0;j--){ if (g[i-1][j] == 'O'){ trackO += 1; } if (g[i-1][j] == 'J'){ total += trackO; } prefixsum[j] += total; } for(int j = 0;j<w;j++){ if (g[i][j] == 'I'){ ans += prefixsum[j]; } } } cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...