제출 #1074188

#제출 시각아이디문제언어결과실행 시간메모리
1074188Joshua_Andersson팀들 (IOI15_teams)C++14
0 / 100
4067 ms20352 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; const ll linf = ll(1e18); typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> p2; #define rep(i, high) for (int i = 0; i < high; i++) #define repp(i, low, high) for (int i = low; i < high; i++) #define repe(i, container) for (auto& i : container) #define sz(container) ((int)container.size()) #define all(x) begin(x),end(x) #if _LOCAL #define assert(x) if (!(x)) __debugbreak() #endif int n; vi a; vi b; typedef pair<double, int> pt; vector<p2> pts; void init(int N, int A[], int B[]) { n = N; a.resize(N); b.resize(N); rep(i, N) a[i] = A[i], b[i] = B[i]; rep(i, n) { pts.emplace_back(b[i], a[i]); } sort(all(pts)); } int rectangle_sum(int xlo, int xhi, int ylo, int yhi) { int ret = 0; repp(i, ylo, yhi+1) { ret += pts[i].second >= xlo && pts[i].second <= xhi; } return ret; } int can(int m, int K[]) { //cout << rectangle_sum(1, 3, 1, 3); vi k(m); rep(i, m) k[i] = K[i]; sort(all(k)); int lo = 0; rep(i, m) { while (lo < sz(pts) && pts[lo].first < k[i]) { lo++; } if (rectangle_sum(0, k[i], lo, n-1)<k[i]) { return 0; } int lob = lo-1; int hib = n; while (lob+1<hib) { int mid = (lob + hib) / 2; if (rectangle_sum(0, k[i], lo, mid) < k[i]) { lob = mid; } else hib = mid; } lo = hib+1; } return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...