제출 #406306

#제출 시각아이디문제언어결과실행 시간메모리
406306ngraceRectangles (IOI19_rect)C++14
37 / 100
5075 ms28312 KiB
#include "rect.h" #include <vector> #include <iostream> using namespace std; long long count_rectangles(std::vector<std::vector<int> > a) { int out=0; int R=a.size(); int C=a[0].size(); for(int r1=1;r1<R-1;r1++){ for(int c1=1;c1<C-1;c1++){ for(int r2=r1;r2<R-1;r2++){ for(int c2=c1;c2<C-1;c2++){ //have rect with top left r1, c1, bottom right r2, c2 //check every value of the rect bool works=true; for(int r=r1;r<=r2;r++){ for(int c=c1;c<=c2;c++){ if(a[r1-1][c]<=a[r][c]){ works=false; break; } if(a[r2+1][c]<=a[r][c]){ works=false; break; } if(a[r][c1-1]<=a[r][c]){ works=false; break; } if(a[r][c2+1]<=a[r][c]){ works=false; break; } } if(!works){ break; } } if(works){ out++; } } } } } return out; }
#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...