Submission #598097

#TimeUsernameProblemLanguageResultExecution timeMemory
598097yutabiRectangles (IOI19_rect)C++14
Compilation error
0 ms0 KiB
#include "rect.h" #include <bits/stdc++.h> using namespace std; long long count_rectangles(std::vector<std::vector<int> > a) { if(n<3) { return 0; } vector <bool> valid(50000,1); int maxi=0; for(int i=0;i<a[1].size();i++) { if(a[1][i]>=a[0][i] || a[1][i]>=a[2][i]) { valid[i]=0; maxi=a[1][i]; } if(a[1][i]>=maxi) { maxi=a[1][i]; valid[i]=0; } } maxi=0; for(int i=a[1].size()-1;i>=0;i--) { if(a[1][i]>=a[0][i] || a[1][i]>=a[2][i]) { valid[i]=0; maxi=a[1][i]; } if(a[1][i]>=maxi) { maxi=a[1][i]; valid[i]=0; } } vector <int> s; int res=0; for(int i=0;i<a[1].size();i++) { while(s.size() && a[1][i]>s.back()) { s.pop_back(); } if(valid[i]==1) { res++; if(s.size() && s.back()==a[1][i]) { res--; } } s.push_back(a[1][i]); } return res; }

Compilation message (stderr)

rect.cpp: In function 'long long int count_rectangles(std::vector<std::vector<int> >)':
rect.cpp:15:5: error: 'n' was not declared in this scope
   15 |  if(n<3)
      |     ^
rect.cpp:24:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |  for(int i=0;i<a[1].size();i++)
      |              ~^~~~~~~~~~~~
rect.cpp:64:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   64 |  for(int i=0;i<a[1].size();i++)
      |              ~^~~~~~~~~~~~