제출 #293699

#제출 시각아이디문제언어결과실행 시간메모리
293699egekabasRectangles (IOI19_rect)C++14
0 / 100
1 ms384 KiB
#include "rect.h" #include <bits/stdc++.h> #define all(x) (x).begin(), (x).end() #define ff first #define ss second #define pb push_back #define mp make_pair using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef pair<ll, ll> pll; typedef pair<ull, ull> pull; typedef pair<int, int> pii; typedef pair<ld, ld> pld; int n, m; ll solven3(vector<std::vector<int> > a){ vector<int> bad; for(int i = 0; i < m; ++i) if(a[1][i] >= a[0][i] || a[1][i] >= a[2][i]){ bad.pb(i); } vector<pii> vec; ll ans = 0; for(int i = m-1; i >= 0; --i){ while(vec.size()){ int idx1 = upper_bound(all(bad), i)-bad.begin(); int idx2 = upper_bound(all(bad), vec.back().ss)-bad.begin()-1; if(idx1 > idx2 && vec.back().ss != i+1) ++ans; if(vec.back().ff > a[1][i]) break; vec.pop_back(); } vec.pb({a[1][i], i}); } return ans; } long long count_rectangles(vector<std::vector<int> > a) { n = a.size(); m = a[0].size(); if(n == 3) return solven3(a); return 0; }
#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...