Submission #822462

# Submission time Handle Problem Language Result Execution time Memory
822462 2023-08-12T03:25:30 Z tfgs Exhibition (JOI19_ho_t2) C++17
100 / 100
52 ms 5600 KB
#include <bits/stdc++.h>
using namespace std;
using pll = pair<long long, long long>;
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define eb emplace_back
#define f first
#define s second
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { os << '{'; string sep; for (const T &x : v) os << sep << x, sep = ", "; return os << '}'; }
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0200r0.html
template<class Fun> class y_combinator_result {
    Fun fun_;
public:
    template<class T> explicit y_combinator_result(T &&fun): fun_(std::forward<T>(fun)) {}
    template<class ...Args> decltype(auto) operator()(Args &&...args) { return fun_(std::ref(*this), std::forward<Args>(args)...); }
};
template<class Fun> decltype(auto) y_combinator(Fun &&fun) { return y_combinator_result<std::decay_t<Fun>>(std::forward<Fun>(fun)); }
#ifdef I_AM_NOOB
#define gg(...) [](const auto&...x){ char c='='; cerr<<#__VA_ARGS__; ((cerr<<exchange(c,',')<<x),...); cerr<<endl; }(__VA_ARGS__);
#else
#define gg(...) 777771449
#endif

constexpr ll INFF = 1e18;
constexpr ll P = 1e9+7;
// constexpr ll P = 998244353;

int main() {
    cin.tie(0) -> ios::sync_with_stdio(0);
    
    ll n, m; while (cin >> n >> m) {
        vector<pll> a(n+1);
        for (ll i = 1; i <= n; i++) {
            cin >> a[i].s >> a[i].f;
        }
        sort(all(a));
        vector<ll> frames(m+1);
        for (ll i = 1; i <= m; i++) {
            cin >> frames[i];
        }
        sort(all(frames));

        ll ans = 0;
        ll j = n;
        for (ll i = m; i >= 1; i--) {
            while (j > 0 && a[j].s > frames[i]) j--;
            if (j == 0) break;
            ans++;
            j--;
            if (j == 0) break;
        }

        cout << ans << endl;
    }
    
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 284 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 324 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 320 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 284 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 324 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 320 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 368 KB Output is correct
30 Correct 1 ms 332 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 328 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 368 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
5 Correct 1 ms 256 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 284 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 324 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 320 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 368 KB Output is correct
30 Correct 1 ms 332 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 328 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 368 KB Output is correct
38 Correct 47 ms 5444 KB Output is correct
39 Correct 35 ms 5556 KB Output is correct
40 Correct 35 ms 5600 KB Output is correct
41 Correct 39 ms 5560 KB Output is correct
42 Correct 42 ms 5452 KB Output is correct
43 Correct 38 ms 5572 KB Output is correct
44 Correct 36 ms 5464 KB Output is correct
45 Correct 39 ms 5580 KB Output is correct
46 Correct 41 ms 5460 KB Output is correct
47 Correct 35 ms 5016 KB Output is correct
48 Correct 38 ms 4936 KB Output is correct
49 Correct 34 ms 4428 KB Output is correct
50 Correct 31 ms 4428 KB Output is correct
51 Correct 40 ms 5468 KB Output is correct
52 Correct 38 ms 5596 KB Output is correct
53 Correct 41 ms 5460 KB Output is correct
54 Correct 32 ms 5508 KB Output is correct
55 Correct 45 ms 5460 KB Output is correct
56 Correct 29 ms 3796 KB Output is correct
57 Correct 15 ms 1992 KB Output is correct
58 Correct 29 ms 3804 KB Output is correct
59 Correct 28 ms 3820 KB Output is correct
60 Correct 16 ms 1992 KB Output is correct
61 Correct 26 ms 3292 KB Output is correct
62 Correct 39 ms 5564 KB Output is correct
63 Correct 38 ms 5568 KB Output is correct
64 Correct 43 ms 5568 KB Output is correct
65 Correct 38 ms 5448 KB Output is correct
66 Correct 38 ms 5448 KB Output is correct
67 Correct 44 ms 5564 KB Output is correct
68 Correct 44 ms 5564 KB Output is correct
69 Correct 40 ms 5468 KB Output is correct
70 Correct 42 ms 5560 KB Output is correct
71 Correct 37 ms 5448 KB Output is correct
72 Correct 44 ms 5568 KB Output is correct
73 Correct 52 ms 5460 KB Output is correct