Submission #818685

#TimeUsernameProblemLanguageResultExecution timeMemory
818685vjudge1Bitaro the Brave (JOI19_ho_t1)C++17
100 / 100
409 ms152832 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll MAXN = 3e3 + 5; ll h, w; string a [MAXN]; ll sat [MAXN][MAXN]; ll nol [MAXN][MAXN]; int main(){ cin >> h >> w; for(ll i = 1; i <= h; i++){ cin >> a[i]; } for(ll i = 1; i <= h; i++){ for(ll j = w-1; j >= 0; j--){ nol[i][j] = nol[i][j+1]; if(a[i][j] == 'O'){ nol[i][j]++; } } } for(ll j = 0; j < w; j++){ for(ll i = h; i >= 1; i--){ sat[i][j] = sat[i+1][j]; if(a[i][j] == 'I'){ sat[i][j]++; } } } ll ans = 0; for(ll i = 1; i <= h; i++){ for(ll j = 0; j < w; j++){ if(a[i][j] == 'J'){ ans += sat[i][j] * nol[i][j]; } } } cout << ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...