제출 #1033983

#제출 시각아이디문제언어결과실행 시간메모리
1033983vjudge1Exhibition (JOI19_ho_t2)C++17
100 / 100
38 ms5724 KiB
#include<bits/stdc++.h>
#define ll long long
#define pll pair<ll, ll>
#define fi first
#define se second
using namespace std;

int n, m;
const int maxn = 2e6;
const int inf = 1e9;
pll p[maxn + 3];
ll c[maxn + 3], ans;
bool vis[maxn + 3];

bool cmp(pll a, pll b)
{
    if(a.se == b.se) return a.fi < b.fi;
    return a.se < b.se;
}

int main()
{
    //freopen("EXHIBITION.INP", "r", stdin);
    //freopen("EXHIBITION.OUT", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> n >> m;
    for(int i = 1; i <= n; i++)
    {
        cin >> p[i].fi >> p[i].se;
    }
    sort(p + 1, p + n + 1, cmp);
    for(int i = 1; i <= m; i++)
    {
        cin >> c[i];
    }
    sort(c + 1, c + m + 1);
    int res = m;
    ll tmp = inf;
    for(int i = n; i >= 1; i--)
    {
        if(res >= 1 && c[res] >= p[i].fi)
        {
            ans++;
            res--;
            //cout << res << ' ' << p[i].fi << '\n';
        }
    }
    cout << ans;
}

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

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:40:8: warning: unused variable 'tmp' [-Wunused-variable]
   40 |     ll tmp = inf;
      |        ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...