제출 #227772

#제출 시각아이디문제언어결과실행 시간메모리
227772NaynaExhibition (JOI19_ho_t2)C++14
100 / 100
99 ms4744 KiB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<int,int>pii;
const int mxn = 1e5+5;

bool cmp(int a, int b)
{
    return a>b;
}
priority_queue<pii>pq;
int arr[mxn];

int main()
{
    int n, m;
    scanf("%d%d", &n, &m);

    for(int i = 1; i <= n; i++)
    {
        int sz, value;
        scanf("%d%d", &sz, &value);
        pq.push(make_pair(value, sz));
    }
    for(int i = 1; i<= m; i++) scanf("%d", &arr[i]);
    sort(arr+1, arr+m+1, cmp);

    int ans = 0;
    for(int i = 1; i <= m; i++)
    {
        while(!pq.empty() && pq.top().second>arr[i]) pq.pop();
        if(pq.empty()) break;
        ans++;
        pq.pop();
    }
    printf("%d\n", ans);
    return 0;
}

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

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &n, &m);
     ~~~~~^~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:23:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d", &sz, &value);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:26:37: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i = 1; i<= m; i++) scanf("%d", &arr[i]);
                                ~~~~~^~~~~~~~~~~~~~~
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…