제출 #348037

#제출 시각아이디문제언어결과실행 시간메모리
348037juggernautRectangles (IOI19_rect)C++14
0 / 100
2 ms492 KiB
#include"rect.h" #include<bits/stdc++.h> #ifdef EVAL #else #include"grader.cpp" #endif using namespace std; int b[2505][2505]; int get(int x,int y,int x2,int y2){ x--,y--; return b[x2][y2]+b[x][y]-b[x][y2]-b[x2][y]; } long long count_rectangles(vector<vector<int>>a){ int n=a.size(),m=a[0].size(); for(int i=0;i<n;i++) for(int j=0;j<m;j++){ b[i][j]=a[i][j]; if(i&&j)b[i][j]-=b[i-1][j-1]; if(i)b[i][j]+=b[i-1][j]; if(j)b[i][j]+=b[i][j-1]; } long long res=0; for(int i=1;i+1<n;i++) for(int j=1;j+1<m;j++) if(!a[i][j]&&a[i][j-1]&&a[i-1][j]){ int x=i; while(!a[x+1][j])x++; int y=j; while(!a[i][y+1])y++; if(!get(i,j,x,y)&&get(i-1,j,i-1,y)==y-j+1&&get(x+1,j,x+1,y)==y-j+1&&get(i,j-1,x,j-1)==x-i+1&&get(i,y+1,x,y+1)==x-i+1)res++; j=y; } return res; }
#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...