제출 #1291077

#제출 시각아이디문제언어결과실행 시간메모리
1291077kubinsgk8Exhibition (JOI19_ho_t2)C++20
100 / 100
37 ms2792 KiB
/*
 * @Author: RMQuan 
 * @Date: 2025-10-29 03:33:48 
 * @Last Modified by: RMQuan
 * @Last Modified time: 2025-10-29 03:37:44
 */
/*idea : 



*/
#include <bits/stdc++.h>
bool M1;
#define int long long
#define ll long long
#define INTMAX INT_MAX
#define INTMIN INT_MIN
#define LONGMAX LLONG_MAX
#define LONGMIN LLONG_MIN
#define fi first
#define se second
#define memfull(a,b) memset(a,b,sizeof(a));
#define endl '\n'
#define TASK "TEST"
#define file() if (fopen(TASK".inp","r")){freopen(TASK".inp","r",stdin); freopen(TASK".out","w",stdout);}
using namespace std;
const int MOD=1e9+7;
const int maxn=1e5+7;
int b[maxn],n,m;
pair<int,int> a[maxn];
bool cmp(pair<int,int> x,pair<int,int> y)
{
    if (x.fi!=y.fi)return x.fi>y.fi;
    else return x.se>y.se;  
}
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    file();
    cin>>n>>m;
    for (int i=1;i<=n;i++)cin>>a[i].se>>a[i].fi;
    for (int i=1;i<=m;i++)cin>>b[i];
    sort(a+1,a+1+n,cmp);
    sort(b+1,b+1+m,greater<int>());
    int ans=0;
    for (int i=1,j=1;i<=n;i++)
    {
        if (j<=m&&b[j]>=a[i].se)
        {
            ans++;
            j++;
        }
    }
    cout<<ans;
    bool M2;
    cerr<<"-------------------------------------------------"<<endl;
    cerr<<"Time : "<<clock()<<" ms"<<endl;
    cerr<<"Memory : "<<abs(&M2-&M1)/1024/1024<<" MB"<<endl;
    cerr<<"-------------------------------------------------"<<endl;
    return 0;
}

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

joi2019_ho_t2.cpp: In function 'int32_t main()':
joi2019_ho_t2.cpp:25:50: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 | #define file() if (fopen(TASK".inp","r")){freopen(TASK".inp","r",stdin); freopen(TASK".out","w",stdout);}
      |                                           ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:41:5: note: in expansion of macro 'file'
   41 |     file();
      |     ^~~~
joi2019_ho_t2.cpp:25:81: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 | #define file() if (fopen(TASK".inp","r")){freopen(TASK".inp","r",stdin); freopen(TASK".out","w",stdout);}
      |                                                                          ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:41:5: note: in expansion of macro 'file'
   41 |     file();
      |     ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...