답안 #241374

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
241374 2020-06-24T06:56:25 Z VEGAnn Kralj (COCI16_kralj) C++14
56 / 140
307 ms 18272 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 500100;
int n, a[N], p[N], v[N];

bool ok(int x){
    for (int i = x - 1; i >= 0; i--)
        if (p[i] > v[n - 1 - (x - 1 - i)])
            return 0;

    return 1;
}

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

#ifdef _LOCAL
    freopen("in.txt","r",stdin);
#endif // _LOCAL

    cin >> n;

    for (int i = 0; i < n; i++)
        cin >> a[i];

    for (int i = 0; i < n; i++)
        cin >> p[i];

    sort(p, p + n);

    for (int i = 0; i < n; i++)
        cin >> v[i];

    sort(v, v + n);

    int l = 0, r = n;

    while (l < r){
        int md = (l + r + 1) >> 1;

        if (ok(md))
            l = md;
        else r = md - 1;
    }

    cout << l;

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 226 ms 13176 KB Output is correct
2 Correct 199 ms 12692 KB Output is correct
3 Correct 266 ms 15584 KB Output is correct
4 Correct 257 ms 15480 KB Output is correct
5 Incorrect 262 ms 16760 KB Output isn't correct
6 Incorrect 250 ms 15096 KB Output isn't correct
7 Incorrect 275 ms 16592 KB Output isn't correct
8 Incorrect 241 ms 15480 KB Output isn't correct
9 Incorrect 307 ms 18272 KB Output isn't correct
10 Incorrect 286 ms 17272 KB Output isn't correct