제출 #248837

#제출 시각아이디문제언어결과실행 시간메모리
248837legendRectangles (IOI19_rect)C++17
37 / 100
5088 ms488080 KiB
#include "rect.h" #include <bits/stdc++.h> using namespace std; int a[2501][2501]; long long count_rectangles(std::vector<std::vector<int> > A) { long long ans = 0; for(int i = 0;i<A.size();i++){ for(int j = 0;j<A[i].size();j++) a[i][j] = A[i][j]; } int n = A.size(); int m = A[0].size(); map<pair<pair<int,int>,pair<int,int> > ,bool > mp; for(int i = 1;i<n-1;i++){ for(int j = 1;j<m-1;j++){ for(int k = j;k<m-1;k++){ for(int ii = i;ii<n-1;ii++){ bool f = true; for(int jj = j;jj<=k;jj++){ if(a[ii][jj]>=a[ii][j-1] || a[ii][jj]>=a[ii][k+1]){ f = false; break; } } if(!f) break; pair<int,int> x = {i,j}; pair<int,int> y = {ii,k}; mp[{x,y}] = true; } } } } for(int i = 1;i<n-1;i++){ for(int j = 1;j<m-1;j++){ for(int k = i;k<n-1;k++){ for(int jj = j;jj<m-1;jj++){ bool f = true; for(int ii = i;ii<=k;ii++){ if(a[ii][jj]>=a[i-1][jj] || a[ii][jj]>=a[k+1][jj]){ f = false; break; } } if(!f) break; pair<int,int> x = {i,j}; pair<int,int> y = {k,jj}; if(mp[{x,y}]) ans++; } } } } return ans; //return 1; }

컴파일 시 표준 에러 (stderr) 메시지

rect.cpp: In function 'long long int count_rectangles(std::vector<std::vector<int> >)':
rect.cpp:8:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0;i<A.size();i++){
                   ~^~~~~~~~~
rect.cpp:9:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j = 0;j<A[i].size();j++) a[i][j] = A[i][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...