답안 #335930

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
335930 2020-12-14T10:25: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;*/
    int curAns = 0, curPic = n;
    for(int 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 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 -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -