제출 #1304185

#제출 시각아이디문제언어결과실행 시간메모리
1304185sharineojExhibition (JOI19_ho_t2)C++20
0 / 100
1 ms576 KiB
#include <bits/stdc++.h>
#define _NVQ ""
#define int long long
#define pii pair<int,int>
#define fi first
#define se second
using namespace std;
int n,m,c[100005];
pii sv[100005];
int32_t main()
{
    if(fopen(_NVQ".INP","r"))
    {
        freopen(_NVQ".INP","r",stdin);
        freopen(_NVQ".OUT","w",stdout);
    }
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin >> n >> m;
    for (int i=1;i<=n;++i)
    {
        cin >> sv[i].fi >> sv[i].se;
    }
    for (int i=1;i<=m;++i)
    {
        cin >> c[i];
    }
    sort(c+1,c+m+1);
    sort(sv+1,sv+n+1);
    int id=1;
    priority_queue <int,vector<int>,greater<int>> pq;
    vector <int> v;
    for (int i=1;i<=m;++i)
    {
        while (sv[id].fi <= c[i] && id <= n)
        {
            pq.push(sv[id].se);
            ++id;
        }
        if (pq.empty()) continue;
        int x = pq.top(); pq.pop();
        auto beo = upper_bound(v.begin(),v.end(),x);
        if (beo==v.end()) v.push_back(x);
        else *beo = x;
    }
    cout << v.size();
}

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

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