제출 #723089

#제출 시각아이디문제언어결과실행 시간메모리
723089GrandTiger1729Rectangles (IOI19_rect)C++17
0 / 100
1 ms340 KiB
#include "rect.h" #include <bits/stdc++.h> using namespace std; long long count_rectangles(std::vector<std::vector<int>> g){ int n = g.size(), m = g[0].size(); int ans = 0; vector<pair<int, int>> res; for (int i = 1; i < n - 1; i++){ for (auto &[l, r]: res){ bool flag = 0; for (int j = l; j <= r; j++) flag |= g[i][j] == 0; ans += !flag; } vector<pair<int, int>> tmp; for (auto &[l, r]: res){ if (g[i][l - 1] == 1 && g[i][r + 1] == 1){ bool flag = 0; for (int j = l; j <= r; j++) flag |= g[i][j] == 1; if (!flag) tmp.emplace_back(l, r); } } for (int j = 0; j < m - 1; j++){ if (g[i][j] == 1){ int l = j, r = j + 1; while (r < m && g[i][r] == 0) r++; bool flag = 0; j++; for (; j < r; j++) flag |= g[i - 1][j] == 0; if (!flag && r - l > 1) tmp.emplace_back(l + 1, r - 1); } } swap(res, tmp); } return ans; }
#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...