Submission #832863

#TimeUsernameProblemLanguageResultExecution timeMemory
832863Marco_EscandonRectangles (IOI19_rect)C++17
0 / 100
1 ms440 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; ll su,iz,de, in; ll contt; vector<vector<ll>> v; ll dfs(ll a, ll b) { if(a==-1||b==-1||a==v.size()||b==v[0].size()) return false; if(v[a][b]==1) return true; su=min(a,su); in=max(a,in); iz=min(b,iz); de=max(b,de); v[a][b]=1; if(dfs(a+1,b)==false) return false; if(dfs(a,b+1)==false) return false; if(dfs(a-1,b)==false) return false; if(dfs(a,b-1)==false) return false; return true; } long long count_rectangles(std::vector<std::vector<int> > a) { if(a[0].size()<4) { ll n=a[0].size(); ll cont=0; if(n<3||a.size()<3) return 0; for(int i=1; i<n-1; i++) { ll ma=0; for(int j=i; j<n-1; j++) { ma=max(ma,(ll)a[1][j]); if(a[1][j]>=a[0][j]||a[1][j]>=a[2][j]) break; if(ma<a[1][i-1]&&ma<a[1][j+1]) cont++; } } return cont; } ll cont=0; v.resize(a.size()); for(int i=0; i<a.size(); i++) { v[i].resize(a[i].size()); for(int j=0; j<a[0].size(); j++) { v[i][j]=a[i][j]; } } for(int i=0; i<a.size(); i++) { for(int j=0; j<a[0].size(); j++) { if(v[i][j]==0) { su= 1000000; in= 0; iz=1000000; de= 0; contt=0; if(dfs(i,j)==false) continue; if(contt==(in-su+1)*(de-iz+1)) cont++; } } } return cont; }

Compilation message (stderr)

rect.cpp: In function 'll dfs(ll, ll)':
rect.cpp:9:23: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     if(a==-1||b==-1||a==v.size()||b==v[0].size())
      |                      ~^~~~~~~~~~
rect.cpp:9:36: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     if(a==-1||b==-1||a==v.size()||b==v[0].size())
      |                                   ~^~~~~~~~~~~~~
rect.cpp: In function 'long long int count_rectangles(std::vector<std::vector<int> >)':
rect.cpp:47:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |     for(int i=0; i<a.size(); i++)
      |                  ~^~~~~~~~~
rect.cpp:50:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |         for(int j=0; j<a[0].size(); j++)
      |                      ~^~~~~~~~~~~~
rect.cpp:55:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |     for(int i=0; i<a.size(); i++)
      |                  ~^~~~~~~~~
rect.cpp:57:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |         for(int j=0; j<a[0].size(); j++)
      |                      ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...