Submission #335932

# Submission time Handle Problem Language Result Execution time Memory
335932 2020-12-14T10:31:07 Z aryan12 Exhibition (JOI19_ho_t2) C++17
0 / 100
2 ms 2668 KB
#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 2;
vector<pair<long long, long long> > pictures(N);
vector<long long> frames(N);
long long n, m;

bool cmp(pair<long long, long long> a, pair<long long, long long> b) {
    return a.second < b.second;
}

void Solve() {
    cin >> n >> m;
    for(long long i = 1; i <= n; i++) {
        cin >> pictures[i].first >> pictures[i].second;
    }
    for(long long i = 1; i <= m; i++) {
        cin >> frames[i];
    }
    sort(pictures.begin() + 1, pictures.begin() + 1 + n, cmp);
    sort(frames.begin() + 1, frames.begin() + 1 + m);
    /*cout << "Sorting of pictures was as follows" << endl;
    for(long long i = 1; i <= n; i++) {
        cout << pictures[i].first << " " << pictures[i].second << endl;
    }
    cout << "Sorting of frames was as follows" << endl;
    for(long long i = 1; i <= m; i++) {
        cout << frames[i] << " ";
    }
    cout << endl;*/
    long long curAns = 0, curPic = n;
    for(long long i = m; i > 0; i--) {
        if(curPic <= 0)
            break;
        while(curPic > 0 && pictures[curPic].first > frames[i]) {
            curPic--;
        }
        if(curPic > 0) {
            curPic--;
            curAns++;
        }
    }
    cout << curAns << endl;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    Solve();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2668 KB Output is correct
2 Correct 2 ms 2668 KB Output is correct
3 Incorrect 2 ms 2668 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2668 KB Output is correct
2 Correct 2 ms 2668 KB Output is correct
3 Incorrect 2 ms 2668 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2668 KB Output is correct
2 Correct 2 ms 2668 KB Output is correct
3 Incorrect 2 ms 2668 KB Output isn't correct
4 Halted 0 ms 0 KB -