Submission #640956

#TimeUsernameProblemLanguageResultExecution timeMemory
640956kkkkkkkkBitaro the Brave (JOI19_ho_t1)C++14
100 / 100
667 ms118484 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n,m; cin >> n >> m; char c[n][m]; vector<pair<int,int> > vj; int mat_o[n][m],mat_i[n][m]; for (int i=0;i<n;i++) for (int j=0;j<m;j++) { cin >> c[i][j]; if (c[i][j]=='J') vj.push_back({i,j}); } for (int i=0;i<m;i++){ if (c[n-1][i]=='I') mat_i[n-1][i]=1; else mat_i[n-1][i]=0; } for (int i=n-2;i>=0;i--) for (int j=m-1;j>=0;j--){ if (c[i][j]=='I') mat_i[i][j]=mat_i[i+1][j]+1; else mat_i[i][j]=mat_i[i+1][j]; } for (int i=0;i<n;i++){ if (c[i][m-1]=='O') mat_o[i][m-1]=1; else mat_o[i][m-1]=0; } for (int i=n-1;i>=0;i--) for (int j=m-2;j>=0;j--){ if (c[i][j]=='O') mat_o[i][j]=mat_o[i][j+1]+1; else mat_o[i][j]=mat_o[i][j+1]; } long long brojac=0; for (int i=0;i<vj.size();i++) { int index_i=vj[i].first,index_j=vj[i].second; brojac+=mat_o[index_i][index_j]*mat_i[index_i][index_j]; } cout << brojac << endl; return 0; }

Compilation message (stderr)

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:41:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |     for (int i=0;i<vj.size();i++)
      |                  ~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...