제출 #744601

#제출 시각아이디문제언어결과실행 시간메모리
744601HoriaHaivasExhibition (JOI19_ho_t2)C++14
0 / 100
0 ms212 KiB
/*
    "TLE is like the wind, always by my side"
    - Yasuo - 2022 -
*/
#include <bits/stdc++.h>
#define debug(x) cerr << #x << " " << x << "\n"
#define debugs(x) cerr << #x << " " << x << " "
#pragma GCC optimize("Ofast")
 
using namespace std;
 
struct painting
{
    int s;
    int v;
};
 
painting a[200001];
int sz[200001];
 
bool cmp(painting aa, painting bb)
{
    return aa.v>bb.v;
}
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,m,i,j,k;
    cin >> n >> m;
    for (i=1;i<=n;i++)
    {
         cin >> a[i].s >> a[i].v;
    }
    for (i=1;i<=m;i++)
    {
        cin >> sz[i];
    }
    sort(sz+1,sz+1+m);
    sort(a+1,a+1+n,cmp);
    k=0;
    for (i=n;i>=1 && m>0;i--)
    {
         if (sz[m]>=a[i].s)
         {
             k++;
             m--;
         }
    }
    cout << k;
}

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

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:31:15: warning: unused variable 'j' [-Wunused-variable]
   31 |     int n,m,i,j,k;
      |               ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...