Submission #106787

# Submission time Handle Problem Language Result Execution time Memory
106787 2019-04-20T13:26:33 Z FiloSanza Exhibition (JOI19_ho_t2) C++14
0 / 100
3 ms 384 KB
#include <bits/stdc++.h>

using namespace std;

struct paint{
    int s, v, i, m = -1;
};

int main(){
    cin.tie(0);
    cin.sync_with_stdio(0);

    int N, M;
    cin >> N >> M;

    vector<int> p;
    vector<int> f(M);
    vector<paint> v(N);
    for(int i=0; i<N; i++) v[i].i = i, cin >> v[i].s >> v[i].v;
    for(auto &i : f) cin >> i;

    sort(f.begin(), f.end());
    sort(v.begin(), v.end(), [](const paint& a, const paint& b){
        return a.v < b.v;
    });
    
    int ans = 0;
    for(int i=N-1, j=M-1; i>=0 && j>=0; ){
        if(v[i].s <= f[j]){
            i--;
            j--;
            ans++;
        }
        else{
            i--;        
        }
    }
    cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Incorrect 3 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Incorrect 3 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Incorrect 3 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -