제출 #316631

#제출 시각아이디문제언어결과실행 시간메모리
316631caoashKralj (COCI16_kralj)C++14
56 / 140
1069 ms40696 KiB
#include <bits/stdc++.h> 
using namespace std;

using ll = long long;

using vi = vector<int>;
using vl = vector<ll>;
#define pb push_back
#define rsz resize
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define lb lower_bound

using pi = pair<int,int>;
#define f first
#define s second
#define mp make_pair

const int MX = 200005;
const int MOD = (int) (1e9 + 7);
const ll INF = (ll) 1e18;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin >> n;
    vi a(n), sx(n);
    set<int> sy;
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) cin >> sx[i];
    for (int i = 0; i < n; i++) {
        int x; cin >> x;
        sy.insert(x);
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        auto it = sy.lb(sx[i]);
        if (it == sy.end()) {
            sy.erase(sy.begin());
        } else {
            ++ans;
            sy.erase(it);
        }
    }
    cout << ans << '\n';
}

#Verdict Execution timeMemoryGrader output
Fetching results...