제출 #106199

#제출 시각아이디문제언어결과실행 시간메모리
106199HideoExhibition (JOI19_ho_t2)C++14
100 / 100
109 ms4716 KiB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pb push_back
#define mk make_pair
#define fr first
#define sc second
#define vi vector < int >
#define vl vector < ll >
#define pi pair < int, int >
#define pii pair < int, pi >
#define vii vector < pi >

const int N = 1e5 + 7;
const int INF = 1e9 + 7;

int c[N];
int n, m, ans;

priority_queue < pi > pq;

main(){
    cin >> n >> m;
    for (int i = 1; i <= n; i++){
        int a, b;
        scanf("%d%d", &a, &b);
        pq.push(mk(b, a));
    }
    for (int i = 1; i <= m; i++)
        scanf("%d", &c[i]);
    sort(c + 1, c + m + 1);
    int it = m;
    while (it > 0 && !pq.empty()){
        if (pq.top().sc <= c[it]){
            it--;
            ans++;
        }
        pq.pop();
    }
    cout << ans;
}

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

joi2019_ho_t2.cpp:23:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:27:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d", &a, &b);
         ~~~~~^~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:31:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &c[i]);
         ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...