Submission #381625

#TimeUsernameProblemLanguageResultExecution timeMemory
381625IwanttobreakfreeBitaro the Brave (JOI19_ho_t1)C++17
20 / 100
73 ms1636 KiB
#include <iostream> #include <vector> using namespace std; int main(){ int h,w; cin>>h>>w; char grid[h][w]; vector<pair<int,int> > v; for(int i=0;i<h;i++){ for(int j=0;j<w;j++){ cin>>grid[i][j]; if(grid[i][j]=='J')v.push_back(make_pair(i,j)); } } int n=v.size(); int sol=0; for(int j=0;j<n;j++){ //cout<<sol<<' '; int x=v[j].first; int y=v[j].second; //cout<<x<<' '<<y<<' '; int co=0,ci=0; for(int i=x;i<h;i++){ if(grid[i][y]=='I')co++; //cout<<grid[i][y]<<' '; } for(int i=y;i<w;i++){ if(grid[x][i]=='O')ci++; // cout<<grid[x][i]<<' '; } //cout<<co<<' '<<ci<<' '; sol+=co*ci; } cout<<sol<<'\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...