답안 #574067

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
574067 2022-06-07T16:43:21 Z Ronin13 Exhibition (JOI19_ho_t2) C++14
0 / 100
1 ms 340 KB
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define f first
#define s second
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pb push_back
#define epb emplace_back
using namespace std;

const ll linf = 1e18 + 1;

int main(){
    int n; cin >> n;
    int m; cin >> m;
    vector <ll> d(n + 1, linf);
    d[0] = 0;
    pll a[n + 1];
    ll b[n + 1];
    for(int i = 1; i <= n; i++){
        cin >> a[i].f >> a[i].s;
    }
    for(int i= 1; i <= m; i++) cin >> b[i];
    int l = 0, r = n + 1;
    sort(a  + 1 , a + 1 + n);
    sort(b + 1, b +  1 + m);
    while(l + 1 < r){
        int mid = (l + r) / 2;
        multiset <ll> st;
        ll last = -1;
        bool ind = true;
        int cur = 1;
        if(m < mid) {
            r = mid;
            continue;
        }
        for(int i = m - mid + 1; i <= m; i++){
            while(cur <= n && a[cur].f <= b[i])
                st.insert(a[cur].s), cur++;
            multiset <ll> :: iterator it = st.lower_bound(last);
            if(it == st.end()){
                ind = false;
                break;
            }
            last = *it;
            st.erase(it);
        }
        if(ind) l = mid;
        else r = mid;
    }
    cout << l;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 296 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 296 KB Output is correct
14 Correct 1 ms 296 KB Output is correct
15 Runtime error 1 ms 340 KB Execution killed with signal 11
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 296 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 296 KB Output is correct
14 Correct 1 ms 296 KB Output is correct
15 Runtime error 1 ms 340 KB Execution killed with signal 11
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 296 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 296 KB Output is correct
14 Correct 1 ms 296 KB Output is correct
15 Runtime error 1 ms 340 KB Execution killed with signal 11
16 Halted 0 ms 0 KB -