#include <iostream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <chrono>
#include <vector>
#include <map>
#include <random>
#include <set>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <deque>
#include <cassert>
#include <stack>
using namespace std;
#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ppb pop_back
#define emb emplace_back
#define ll long long
#define ull unsigned long long
#define cntbit(x) __builtin_popcount(x)
#define endl '\n'
#define uset unordered_set
#define umap unordered_map
#define pii pair<int, int>
#define ld long double
#define pll pair<long long, long long>
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T> inline T range(T l, T r) {
return uniform_int_distribution<T>(l, r)(rng);
}
inline void setin(string s) {
freopen(s.c_str(), "r", stdin);
}
inline void setout(string s) {
freopen(s.c_str(), "w", stdout);
}
template <typename T> void Min(T &a, T b) {
a = min(a, b);
}
template <typename T> void Max(T &a, T b) {
a = max(a, b);
}
const int inf = 0x3f3f3f3f;
const int mod = 998244353;
const int N = 5e5 + 15;
int n, a[N], b[N], c[N];
vector <int> ord;
int ans;
set <int> is;
main() {
ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
// setin("input.txt");
cin >> n;
for(int i = 1; i <= n; ++i)
cin >> a[i];
for(int i = 1; i <= n; ++i)
cin >> c[i];
for(int i = 1; i <= n; ++i) {
cin >> b[i];
is.insert(b[i]);
}
sort(c + 1, c + 1 + n);
sort(b + 1, b + 1 + n);
for(int i = 1; i <= n; ++i) {
set <int>::iterator it = is.lower_bound(c[i]);
if(it == is.end())
it = is.begin();
else
++ans;
is.erase(it);
}
cout << ans << endl;
return 0;
}
Compilation message
kralj.cpp:69:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main() {
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
497 ms |
32376 KB |
Output is correct |
2 |
Correct |
517 ms |
31512 KB |
Output is correct |
3 |
Correct |
696 ms |
37880 KB |
Output is correct |
4 |
Correct |
713 ms |
38580 KB |
Output is correct |
5 |
Incorrect |
674 ms |
35832 KB |
Output isn't correct |
6 |
Incorrect |
658 ms |
35704 KB |
Output isn't correct |
7 |
Incorrect |
701 ms |
36928 KB |
Output isn't correct |
8 |
Incorrect |
588 ms |
34168 KB |
Output isn't correct |
9 |
Incorrect |
771 ms |
38512 KB |
Output isn't correct |
10 |
Incorrect |
741 ms |
38648 KB |
Output isn't correct |