Submission #1000201

#TimeUsernameProblemLanguageResultExecution timeMemory
1000201IcelastBitaro the Brave (JOI19_ho_t1)C++17
100 / 100
198 ms159344 KiB
#include <iostream> #include <bits/stdc++.h> #define ll long long using namespace std; const ll maxn = 2*1e5+5, INF = 4e18+9; void solve(){ int n, m; cin >> n >> m; vector<string> s(n+1); for(int i = 1; i <= n; i++){ cin >> s[i]; s[i] = ' ' + s[i]; } vector<vector<ll>> orb(n+2, vector<ll>(m+2, 0)), ingot(n+2, vector<ll>(m+2, 0)); for(int i = 1; i <= n; i++){ for(int j = m; j >= 1; j--){ orb[i][j] = orb[i][j+1]; if(s[i][j] == 'O') orb[i][j]++; } } for(int j = 1; j <= m; j++){ for(int i = n; i >= 1; i--){ ingot[i][j] = ingot[i+1][j]; if(s[i][j] == 'I') ingot[i][j]++; } } ll ans = 0; for(int i = 1; i <= n; i++){ for(int j = 1; j <= m; j++){ if(s[i][j] == 'J'){ ans += orb[i][j+1]*ingot[i+1][j]; } } } cout << ans; } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...