Submission #844648

#TimeUsernameProblemLanguageResultExecution timeMemory
844648leanchecBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
270 ms89348 KiB
#include<bits/stdc++.h> using namespace std; int main(){ int h, w; vector<string> grid; cin >> h >> w; for(int i=0; i<h; i++){ string a; cin >> a; grid.push_back(a); } int sumO[3010][3010]={}, sumI[3010][3010]={}; for(int i=h-1; i>=0; i--){ for(int j=w-1; j>=0; j--){ sumO[i][j]=sumO[i][j+1]; if(grid[i][j]=='O')sumO[i][j]++; sumI[i][j]=sumI[i+1][j]; if(grid[i][j]=='I')sumI[i][j]++; } } long long resp=0; for(int i=0; i<h; i++){ for(int j=0; j<w; j++){ if(grid[i][j]!='J')continue; resp+=(long long)sumO[i][j]*sumI[i][j]; } } cout << resp << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...