# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1095906 |
2024-10-03T11:42:16 Z |
Phuoc |
Exhibition (JOI19_ho_t2) |
C++14 |
|
1 ms |
348 KB |
#include <bits/stdc++.h>
#include <ctime>
#include <algorithm>
#include <random>
using namespace std;
#define el '\n'
#define ll long long
#define fi first
#define se second
#define BIT(mask, i) (((mask) >> (i)) & 1)
#define MASK(i) (1LL << (i))
const ll INF = (ll)1e18 + 9;
const int oo = (int)1e9 + 7;
const ll MOD = (ll)1e9 + 7;
template <class T1, class T2>
bool minimize(T1 &a, T2 b) {
if(a > b) {a = b; return true;} return false;
}
template <class T1, class T2>
bool maximize(T1 &a, T2 b) {
if(a < b) {a = b; return true;} return false;
}
template <class T1, class T2>
void add (T1 &a, T2 b) {
a += b;
if (a >= MOD) a -= MOD;
}
const int N = 100100;
int n, m;
pair <ll, ll> pics [N];
ll frames[N];
void init (void) {
cin >> n >> m;
for (int i = 1; i <= n; i++) cin >> pics[i].fi >> pics[i].se;
for (int i = 1; i <= m; i++) cin >> frames[i];
}
int f[N];
bool cmp (pair <ll, ll> a, pair <ll, ll> b) {
if(a.se != b.se) return a.se < b.se;
else return a.fi < b.fi;
}
void solve (void) {
sort (pics + 1, pics + n + 1, cmp);
int ans = 0;
sort(frames + 1, frames + m + 1);
int j = n;
for (int i = m; i >= 1; i--) {
while(frames[i] < pics[j].fi && i > 0) i--;
if(frames[i] >= pics[j].fi) {
ans++;
}
}
cout << ans;
}
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define test "test"
// freopen (test".inp", "r", stdin);
// freopen (test".out", "w", stdout);
srand(time(0));
int ntest = 1;
// cin >> ntest;
while(ntest--) {
init();
solve();
}
return 0;
}
// chim chim chim orz orz orz
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |