Submission #522645

# Submission time Handle Problem Language Result Execution time Memory
522645 2022-02-05T10:01:39 Z ddy888 Exhibition (JOI19_ho_t2) C++17
0 / 100
1 ms 204 KB
#undef _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define int long long 
#define pb push_back
#define fi first
#define si second
#define ar array
typedef pair<int,int> pi;
typedef tuple<int,int,int> ti;  
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {cerr << " " << to_string(H);debug_out(T...);}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

int N, M, ans;
vector<pi> pic;
vector<int> frame;

signed main() {
    fast;
    cin >> N >> M;
    pic.resize(N + 1);
    frame.resize(M + 1);
    for (int i = 1; i <= N; ++i) cin >> pic[i].fi >> pic[i].si;
    for (int i = 1; i <= M; ++i) cin >> frame[i];
    sort(pic.begin() + 1, pic.end(), [](pi a, pi b) {
        return a.si > b.si;
    });
    sort(frame.begin() + 1, frame.end(), greater<int>());
    int idx = 1;
    for (int i = 1; i <= M; ++i) {
        while (idx <= N && pic[idx].fi > frame[i]) ++idx;
        if (idx == N + 1) break;
        ++ans; ++idx;
    }
    cout << ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -