Submission #126515

#TimeUsernameProblemLanguageResultExecution timeMemory
126515triExhibition (JOI19_ho_t2)C++14
100 / 100
288 ms5148 KiB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;

#define pb push_back
#define f first
#define s second

int main() {
    int N, M;
    cin >> N >> M;
    vector<pi> pictures;
    for (int i = 0; i < N; i++) {
        int s, v;
        cin >> s >> v;
        pictures.pb({v, s});
    }

    vi frames;
    for (int i = 0; i < M; i++) {
        int s;
        cin >> s;
        frames.pb(s);
    }

    sort(pictures.begin(), pictures.end());
    sort(frames.begin(), frames.end());

    reverse(pictures.begin(), pictures.end());
    reverse(frames.begin(), frames.end());

    int nP = 0, ans = 0;
    for (int i = 0; i < frames.size(); i++) {
        while (nP < pictures.size() && pictures[nP].s > frames[i]) {
            nP++;
        }
        if (nP == pictures.size()) {
            break;
        }
        ans++;
        nP++;
    }
    cout << ans << endl;
}

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:41:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < frames.size(); i++) {
                     ~~^~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:42:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         while (nP < pictures.size() && pictures[nP].s > frames[i]) {
                ~~~^~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:45:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (nP == pictures.size()) {
             ~~~^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...