이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |