제출 #228932

#제출 시각아이디문제언어결과실행 시간메모리
228932JodsintZExhibition (JOI19_ho_t2)C++14
0 / 100
5 ms384 KiB
#include <bits/stdc++.h>

#define pii pair<int, int>
#define x first
#define y second

using namespace std;

const int N = 1e5+5;

int n, m, c[N], ptr1, ans;
vector<pii> a;

int main() {
    scanf("%d %d" ,&n, &m);
    for(int i = 0, C, v; i < n; i++) {
        scanf("%d %d", &C, &v);
        a.emplace_back(v, C);
    }
    for(int i = 0; i < m; i++) {
        scanf("%d", c + i);
    }
    sort(c+0, c+n, greater<int>() );
    sort(a.begin(), a.end(), greater<pii>() );

    for(int i = 0; i < m; i++) {
        while(ptr1 < n && a[ptr1].y > c[i] ) ptr1++;
        if(ptr1 < n) ans++, ptr1++;
    }

    printf("%d\n", ans);

}

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

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:15: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:17:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &C, &v);
         ~~~~~^~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:21: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...