제출 #199768

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

#define pb push_back
#define mp make_pair
#define taskname "A"

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
const int maxn = 1e5 + 5;
ii a[maxn];
int b[maxn];
int n  , m;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    if(fopen(taskname".INP","r")){
		freopen(taskname".INP", "r",stdin);
		freopen(taskname".OUT", "w",stdout);
    }
    cin >> n >> m;
    for(int i = 1 ; i <= n ; ++i)cin >> a[i].second >> a[i].first;
    for(int i = 1 ; i <= m ; ++i)cin >> b[i];
    sort(a + 1 , a + n + 1,greater<ii>());
    sort(b + 1 , b + m + 1,greater<int>());
    int j = 1;
    int res = 0;
    for(int i = 1 ; i <= m ; ++i){
        while(j <= n && a[j].second > b[i])++j;
        if(j > n)break;
        ++j;
        res++;
    }
    cout << res;
}

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

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:22:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   freopen(taskname".INP", "r",stdin);
   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:23:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   freopen(taskname".OUT", "w",stdout);
   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...