| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1364277 | mythofys | Grilled Bottle (KAISTRUN26SPRING_D) | C++20 | 196 ms | 16664 KiB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define inf 4000000000000000000
#define mod 998244353
#define siz 524288
struct A
{
ll f,v;
}d[200005];
bool cmp(A i,A j)
{
return i.f < j.f;
}
priority_queue < ll > pq;
multiset < ll > s;
ll a[200005];
int main()
{
ll i,j,k,n,m,ans = 0;
scanf("%lld %lld",&n,&m);
for(i=1;i<=n;i++)
{
scanf("%lld %lld",&d[i].f,&d[i].v);
s.insert(d[i].f);
}
for(i=1;i<=m;i++)
{
scanf("%lld",&a[i]);
}
for(i=1;i<=m;i++)
{
if(s.lower_bound(a[i]) == s.end())break;
s.erase(s.lower_bound(a[i]));
}
i--;
printf("%lld ",i);
sort(a+1,a+i+1);
sort(d+1,d+1+n,cmp);
ll tail = n;
for(;i>=1;i--)
{
while(d[tail].f >= a[i])
{
pq.push(d[tail].v);
tail--;
}
ans += pq.top();
pq.pop();
}
printf("%lld",ans);
}Compilation message (stderr)
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
