답안 #1023705

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1023705 2024-07-15T05:07:59 Z trandangquang Exhibition (JOI19_ho_t2) C++14
100 / 100
38 ms 4688 KB
#include <bits/stdc++.h>

using namespace std;

#define task "test"
#define FOR(i, a, b) for(int i = (a); i <= (b); ++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define sz(a) (int)(a).size()
#define all(a) (a).begin(), (a).end()
#define bit(s, i) (((s) >> (i)) & 1)
#define ii pair <int, int>
#define vii vector <ii>
#define vi vector <int>
#define fi first
#define se second
#define ll long long
#define eb emplace_back
#define pb push_back
#define __builtin_popcount __builtin_popcountll

void solve();

int32_t main() {
    if(fopen(task".inp", "r")) {
		freopen(task".inp", "r", stdin);
		freopen(task".out", "w", stdout);
	}
	cin.tie(0)->sync_with_stdio(0);

    int tc = 1; // cin >> tc;
    FOR(i, 1, tc) {
        solve();
    }
}

const int N = 100100;

int n, m, frame[N];
ii pic[N];

void solve() {
    cin >> n >> m;
    FOR(i, 1, n) cin >> pic[i].fi >> pic[i].se;
    FOR(i, 1, m) cin >> frame[i];

    sort(pic+1, pic+1+n, [] (ii x, ii y) {return x.se < y.se || (x.se == y.se && x.fi < y.fi);});
    sort(frame+1, frame+1+m);

    int pt1 = m, ans = 0;
    FORD(i, n, 1) {
        if(pt1 > 0 && pic[i].fi <= frame[pt1]) {
            ++ans;
            --pt1;
        }
    }

    cout << ans;
}

Compilation message

joi2019_ho_t2.cpp: In function 'int32_t main()':
joi2019_ho_t2.cpp:25:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |   freopen(task".inp", "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:26:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |   freopen(task".out", "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 460 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 600 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 460 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 600 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 480 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 476 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 596 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 1 ms 604 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 460 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 600 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 480 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 476 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 596 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 1 ms 604 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
38 Correct 32 ms 4528 KB Output is correct
39 Correct 30 ms 4436 KB Output is correct
40 Correct 28 ms 4416 KB Output is correct
41 Correct 33 ms 4444 KB Output is correct
42 Correct 32 ms 4444 KB Output is correct
43 Correct 32 ms 4436 KB Output is correct
44 Correct 31 ms 4432 KB Output is correct
45 Correct 32 ms 4324 KB Output is correct
46 Correct 35 ms 4688 KB Output is correct
47 Correct 30 ms 4088 KB Output is correct
48 Correct 29 ms 4272 KB Output is correct
49 Correct 27 ms 3672 KB Output is correct
50 Correct 27 ms 3696 KB Output is correct
51 Correct 34 ms 4312 KB Output is correct
52 Correct 35 ms 4436 KB Output is correct
53 Correct 32 ms 4436 KB Output is correct
54 Correct 27 ms 4416 KB Output is correct
55 Correct 32 ms 4436 KB Output is correct
56 Correct 21 ms 3164 KB Output is correct
57 Correct 13 ms 1624 KB Output is correct
58 Correct 20 ms 3160 KB Output is correct
59 Correct 21 ms 3164 KB Output is correct
60 Correct 13 ms 1624 KB Output is correct
61 Correct 20 ms 2648 KB Output is correct
62 Correct 33 ms 4420 KB Output is correct
63 Correct 33 ms 4432 KB Output is correct
64 Correct 35 ms 4400 KB Output is correct
65 Correct 34 ms 4432 KB Output is correct
66 Correct 34 ms 4432 KB Output is correct
67 Correct 38 ms 4436 KB Output is correct
68 Correct 36 ms 4412 KB Output is correct
69 Correct 34 ms 4452 KB Output is correct
70 Correct 36 ms 4436 KB Output is correct
71 Correct 32 ms 4436 KB Output is correct
72 Correct 34 ms 4340 KB Output is correct
73 Correct 31 ms 4420 KB Output is correct