제출 #1030928

#제출 시각아이디문제언어결과실행 시간메모리
1030928ZicrusRectangles (IOI19_rect)C++17
13 / 100
132 ms62616 KiB
#include <bits/stdc++.h> #include "rect.h" using namespace std; typedef long long ll; ll n, m; ll count_rectangles(vector<vector<int>> a) { if (a.size() <= 2) return 0; n = a.size(); m = a[0].size(); vector<vector<bool>> vst(n, vector<bool>(m)); ll res = 0; for (int i = 1; i < n-1; i++) { for (int j = 1; j < m-1; j++) { if (a[i][j] || vst[i][j]) continue; ll ptrN = i, ptrM = j; while (!a[ptrN][ptrM] && ptrM < m-1) ptrM++; ptrM--; while (!a[ptrN][ptrM] && ptrN < n-1) ptrN++; ptrN--; bool poss = true; for (int x = i; x <= ptrN && poss; x++) { for (int y = j; y <= ptrM && poss; y++) { vst[x][y] = true; if (a[x][y]) poss = false; } } for (int x = i; x <= ptrN && poss; x++) { if (!a[x][j-1]) poss = false; if (!a[x][ptrM+1]) poss = false; } for (int y = j; y <= ptrM && poss; y++) { if (!a[i-1][y]) poss = false; if (!a[ptrN+1][y]) poss = false; } res += poss; } } 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...