답안 #108744

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
108744 2019-05-01T08:12:31 Z tictaccat Exhibition (JOI19_ho_t2) C++14
0 / 100
5 ms 2816 KB
#include <bits/stdc++.h>

using namespace std;

const int MAX = 1e5 + 10;

int N,M;
vector<pair<int,int>> pics(MAX);
vector<int> C(MAX);

bool check(int k) {
    int j = 0;
    for (int i = 0; i < k; i++) {
        while (j < N && pics[j].first > C[M-k+i]) j++;
        if (j == N) return false;
        j++;
    }
    return true;
}

int main() {

    cin >> N >> M;
    for (int i = 0; i < N; i++) cin >> pics[i].first >> pics[i].second;
    for (int i = 0; i < M; i++) cin >> C[i];

    sort(pics.begin(),pics.begin()+N,[](pair<int,int> p1, pair<int,int> p2) {return p1.second < p2.second || (p1.second == p2.second && p1.first < p2.first);});
    sort(C.begin(),C.begin()+M);

    int k = 0; int high = N+1;

    for (int b = high/2; b > 0; b /= 2) {
        while (k + b < high && check(k+b)) k += b;
    }

    cout << k << "\n";

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1536 KB Output is correct
2 Correct 4 ms 1536 KB Output is correct
3 Correct 3 ms 1536 KB Output is correct
4 Correct 4 ms 1536 KB Output is correct
5 Correct 3 ms 1536 KB Output is correct
6 Correct 3 ms 1536 KB Output is correct
7 Correct 5 ms 1536 KB Output is correct
8 Correct 4 ms 1536 KB Output is correct
9 Correct 3 ms 1536 KB Output is correct
10 Correct 3 ms 1536 KB Output is correct
11 Correct 4 ms 1536 KB Output is correct
12 Correct 3 ms 1536 KB Output is correct
13 Correct 4 ms 1580 KB Output is correct
14 Correct 3 ms 1536 KB Output is correct
15 Correct 3 ms 1536 KB Output is correct
16 Runtime error 5 ms 2816 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1536 KB Output is correct
2 Correct 4 ms 1536 KB Output is correct
3 Correct 3 ms 1536 KB Output is correct
4 Correct 4 ms 1536 KB Output is correct
5 Correct 3 ms 1536 KB Output is correct
6 Correct 3 ms 1536 KB Output is correct
7 Correct 5 ms 1536 KB Output is correct
8 Correct 4 ms 1536 KB Output is correct
9 Correct 3 ms 1536 KB Output is correct
10 Correct 3 ms 1536 KB Output is correct
11 Correct 4 ms 1536 KB Output is correct
12 Correct 3 ms 1536 KB Output is correct
13 Correct 4 ms 1580 KB Output is correct
14 Correct 3 ms 1536 KB Output is correct
15 Correct 3 ms 1536 KB Output is correct
16 Runtime error 5 ms 2816 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1536 KB Output is correct
2 Correct 4 ms 1536 KB Output is correct
3 Correct 3 ms 1536 KB Output is correct
4 Correct 4 ms 1536 KB Output is correct
5 Correct 3 ms 1536 KB Output is correct
6 Correct 3 ms 1536 KB Output is correct
7 Correct 5 ms 1536 KB Output is correct
8 Correct 4 ms 1536 KB Output is correct
9 Correct 3 ms 1536 KB Output is correct
10 Correct 3 ms 1536 KB Output is correct
11 Correct 4 ms 1536 KB Output is correct
12 Correct 3 ms 1536 KB Output is correct
13 Correct 4 ms 1580 KB Output is correct
14 Correct 3 ms 1536 KB Output is correct
15 Correct 3 ms 1536 KB Output is correct
16 Runtime error 5 ms 2816 KB Execution killed with signal 11 (could be triggered by violating memory limits)
17 Halted 0 ms 0 KB -