답안 #335935

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
335935 2020-12-14T10:35:11 Z aryan12 Exhibition (JOI19_ho_t2) C++17
0 / 100
1 ms 364 KB
#include <bits/stdc++.h>
using namespace std;

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

void Solve() {
    long long n, m;
    cin >> n >> m;
    vector<pair<long long, long long> > pictures(n + 1);
    vector<long long> frames(m + 1);
    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.end(), cmp);
    sort(frames.begin() + 1, frames.end());
    /*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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Incorrect 0 ms 364 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Incorrect 0 ms 364 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Incorrect 0 ms 364 KB Output isn't correct
4 Halted 0 ms 0 KB -