Submission #381637

#TimeUsernameProblemLanguageResultExecution timeMemory
381637IwanttobreakfreeBitaro the Brave (JOI19_ho_t1)C++17
50 / 100
1084 ms23264 KiB
#include <iostream> #include <vector> using namespace std; int main(){ cin.tie(0); ios::sync_with_stdio(false); long long int h,w; cin>>h>>w; char grid[h][w]; int canti[h][w]; int canto[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]; canti[i][j]=0; canto[i][j]=0; if(grid[i][j]=='J')v.push_back(make_pair(i,j)); if(grid[i][j]=='I'){ for(int x=i;x>=0;x--)canti[x][j]++; } if(grid[i][j]=='O'){ for(int x=j;x>=0;x--)canto[i][x]++; } } } int n=v.size(); long long int sol=0; for(int j=0;j<n;j++){ int x=v[j].first,y=v[j].second; sol+=canti[x][y]*canto[x][y]; } cout<<sol<<'\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...