제출 #1364277

#제출 시각아이디문제언어결과실행 시간메모리
1364277mythofysGrilled Bottle (KAISTRUN26SPRING_D)C++20
100 / 100
196 ms16664 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);
}

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'int main()':
Main.cpp:28:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |     scanf("%lld %lld",&n,&m);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~
Main.cpp:31:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |         scanf("%lld %lld",&d[i].f,&d[i].v);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:36:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   36 |         scanf("%lld",&a[i]);
      |         ~~~~~^~~~~~~~~~~~~~
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…