Submission #316631

# Submission time Handle Problem Language Result Execution time Memory
316631 2020-10-26T23:30:15 Z caoash Kralj (COCI16_kralj) C++14
56 / 140
1069 ms 40696 KB
#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 time Memory Grader output
1 Correct 785 ms 30968 KB Output is correct
2 Correct 460 ms 29688 KB Output is correct
3 Correct 598 ms 37036 KB Output is correct
4 Correct 595 ms 37496 KB Output is correct
5 Incorrect 964 ms 37000 KB Output isn't correct
6 Incorrect 563 ms 36128 KB Output isn't correct
7 Incorrect 1016 ms 38520 KB Output isn't correct
8 Incorrect 762 ms 34588 KB Output isn't correct
9 Incorrect 1069 ms 40696 KB Output isn't correct
10 Incorrect 915 ms 39800 KB Output isn't correct