# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
316631 | caoash | Kralj (COCI16_kralj) | C++14 | 1069 ms | 40696 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|---|---|---|---|
Fetching results... |