Submission #1023726

# Submission time Handle Problem Language Result Execution time Memory
1023726 2024-07-15T05:27:55 Z trandangquang Exhibition (JOI19_ho_t2) C++14
100 / 100
40 ms 4528 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 = n, ans = 0;
    FORD(i, m, 1) {
        while(pic[pt1].fi > frame[i]) --pt1;
        if(pt1>0 && pic[pt1].fi <= frame[i]) {
            ++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);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 460 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 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 348 KB Output is correct
13 Correct 0 ms 348 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
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 460 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 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 348 KB Output is correct
13 Correct 0 ms 348 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 512 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 344 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 500 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 500 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 344 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 460 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 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 348 KB Output is correct
13 Correct 0 ms 348 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 512 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 344 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 500 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 500 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 344 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
38 Correct 35 ms 4432 KB Output is correct
39 Correct 30 ms 4432 KB Output is correct
40 Correct 27 ms 4348 KB Output is correct
41 Correct 33 ms 4444 KB Output is correct
42 Correct 32 ms 4448 KB Output is correct
43 Correct 32 ms 4304 KB Output is correct
44 Correct 32 ms 4504 KB Output is correct
45 Correct 33 ms 4316 KB Output is correct
46 Correct 34 ms 4432 KB Output is correct
47 Correct 40 ms 4084 KB Output is correct
48 Correct 29 ms 3928 KB Output is correct
49 Correct 28 ms 3676 KB Output is correct
50 Correct 28 ms 3572 KB Output is correct
51 Correct 37 ms 4444 KB Output is correct
52 Correct 34 ms 4440 KB Output is correct
53 Correct 34 ms 4444 KB Output is correct
54 Correct 27 ms 4444 KB Output is correct
55 Correct 32 ms 4444 KB Output is correct
56 Correct 21 ms 3164 KB Output is correct
57 Correct 13 ms 1684 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 2548 KB Output is correct
62 Correct 34 ms 4440 KB Output is correct
63 Correct 40 ms 4432 KB Output is correct
64 Correct 40 ms 4384 KB Output is correct
65 Correct 34 ms 4432 KB Output is correct
66 Correct 34 ms 4444 KB Output is correct
67 Correct 34 ms 4356 KB Output is correct
68 Correct 34 ms 4436 KB Output is correct
69 Correct 34 ms 4324 KB Output is correct
70 Correct 35 ms 4432 KB Output is correct
71 Correct 33 ms 4432 KB Output is correct
72 Correct 33 ms 4444 KB Output is correct
73 Correct 31 ms 4528 KB Output is correct