Submission #1073396

#TimeUsernameProblemLanguageResultExecution timeMemory
1073396RKHTMBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
126 ms18004 KiB
#include <bits/stdc++.h> using namespace std; #define yasuho ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define endl "\n" typedef long long ll; const ll MOD = 1e9+7; void solve(){ ll r, c; cin >> r >> c; vector<vector<char>> grid(r+1, vector<char>(c+1)); for(int i=1; i<=r; i++){ for(int j=1; j<=c; j++){ cin >> grid[i][j]; } } vector<ll> ingot(c+1, 0); ll ans = 0; for(int i=r; i>=1; i--){ ll orb=0; for(int j=c; j>=1; j--){ if(grid[i][j]=='J'){ // cout << ingot[j] << ' ' << orb << endl; ans += ingot[j]*orb; } if(grid[i][j]=='I') ingot[j]++; if(grid[i][j]=='O') orb++; } } cout << ans << endl; return; } int main(){ yasuho // remove for interactive problem ll t; t = 1; //cin >> t; while(t--) solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...