| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1033968 | vjudge1 | Exhibition (JOI19_ho_t2) | C++17 | 1 ms | 4560 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define ll long long
#define pll pair<ll, ll>
#define fi first
#define se second
using namespace std;
int n, m;
const int maxn = 2e6;
const int inf = 1e9;
pll p[maxn + 3];
ll c[maxn + 3], ans;
bool vis[maxn + 3];
bool cmp(pll a, pll b)
{
if(a.se == b.se) return a.fi < b.fi;
return a.se < b.se;
}
int main()
{
// freopen("EXHIBITION.INP", "r", stdin);
// freopen("EXHIBITION.OUT", "w", stdout);
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> m;
for(int i = 1; i <= n; i++)
{
cin >> p[i].fi >> p[i].se;
}
sort(p + 1, p + n + 1, cmp);
for(int i = 1; i <= m; i++)
{
cin >> c[i];
}
sort(c + 1, c + n + 1);
ll tmp = inf;
for(int i = n; i >= 1; i--)
{
int l = 1, r = m, res = 0, mid = 0;
while(l <= r)
{
mid = (l + r) / 2;
if(c[mid] >= p[i].fi && !vis[mid] && tmp >= c[mid])
{
l = mid + 1;
res = mid;
}
else l = mid + 1;
}
if(res != 0)
{
ans ++;
vis[res] == true;
tmp = c[res];
}
}
cout << ans;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
