# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
529921 | 2022-02-24T03:42:11 Z | kevin | Exhibition (JOI19_ho_t2) | C++17 | 108 ms | 9196 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long #define nl cout<<"\n" #define all(x) x.begin(), x.end() #define f first #define s second #define ca(v) for(auto i:v) cout<<i<<" "; const int MOD = 1e9 + 7; int main() { ios_base::sync_with_stdio(0); cin.tie(0); if (fopen("input.in", "r")) freopen("input.in", "r", stdin); int n, m; cin>>n>>m; vector<pair<int, int>> ar; for(int i=0; i<n; i++){ int x, v; cin>>x>>v; ar.push_back({x, v}); } vector<int> sz(m); for(int i=0; i<m; i++) cin>>sz[i]; sort(all(ar)); sort(all(sz)); multiset<pair<int, int>> ms; for(auto p:ar) ms.insert({p.s, p.f}); int ans = 0; int last = 2e9; for(int i=m-1; i>=0; i--){ while(ar.size() && ar.back().f > sz[i]) { auto it = ms.find({ar.back().s, ar.back().f}); if(it != ms.end()) ms.erase(it); ar.pop_back(); } while(ms.size() && ms.rbegin()->f > last) ms.erase(--ms.end()); if(ms.size()){ ans++; last = ms.rbegin()->f; ms.erase(--ms.end()); } } cout<<ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 312 KB | Output is correct |
4 | Correct | 1 ms | 316 KB | Output is correct |
5 | Correct | 1 ms | 312 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 0 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 0 ms | 204 KB | Output is correct |
10 | Correct | 0 ms | 312 KB | Output is correct |
11 | Correct | 0 ms | 204 KB | Output is correct |
12 | Correct | 0 ms | 204 KB | Output is correct |
13 | Correct | 0 ms | 312 KB | Output is correct |
14 | Correct | 0 ms | 204 KB | Output is correct |
15 | Correct | 0 ms | 204 KB | Output is correct |
16 | Correct | 1 ms | 204 KB | Output is correct |
17 | Correct | 1 ms | 204 KB | Output is correct |
18 | Correct | 1 ms | 204 KB | Output is correct |
19 | Correct | 1 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 312 KB | Output is correct |
4 | Correct | 1 ms | 316 KB | Output is correct |
5 | Correct | 1 ms | 312 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 0 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 0 ms | 204 KB | Output is correct |
10 | Correct | 0 ms | 312 KB | Output is correct |
11 | Correct | 0 ms | 204 KB | Output is correct |
12 | Correct | 0 ms | 204 KB | Output is correct |
13 | Correct | 0 ms | 312 KB | Output is correct |
14 | Correct | 0 ms | 204 KB | Output is correct |
15 | Correct | 0 ms | 204 KB | Output is correct |
16 | Correct | 1 ms | 204 KB | Output is correct |
17 | Correct | 1 ms | 204 KB | Output is correct |
18 | Correct | 1 ms | 204 KB | Output is correct |
19 | Correct | 1 ms | 204 KB | Output is correct |
20 | Correct | 2 ms | 328 KB | Output is correct |
21 | Correct | 1 ms | 332 KB | Output is correct |
22 | Correct | 1 ms | 332 KB | Output is correct |
23 | Correct | 1 ms | 332 KB | Output is correct |
24 | Correct | 2 ms | 332 KB | Output is correct |
25 | Correct | 2 ms | 332 KB | Output is correct |
26 | Correct | 1 ms | 332 KB | Output is correct |
27 | Correct | 1 ms | 356 KB | Output is correct |
28 | Correct | 2 ms | 356 KB | Output is correct |
29 | Correct | 1 ms | 332 KB | Output is correct |
30 | Correct | 1 ms | 332 KB | Output is correct |
31 | Correct | 1 ms | 332 KB | Output is correct |
32 | Correct | 1 ms | 332 KB | Output is correct |
33 | Correct | 1 ms | 204 KB | Output is correct |
34 | Correct | 1 ms | 332 KB | Output is correct |
35 | Correct | 1 ms | 320 KB | Output is correct |
36 | Correct | 1 ms | 332 KB | Output is correct |
37 | Correct | 1 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 312 KB | Output is correct |
4 | Correct | 1 ms | 316 KB | Output is correct |
5 | Correct | 1 ms | 312 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 0 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 0 ms | 204 KB | Output is correct |
10 | Correct | 0 ms | 312 KB | Output is correct |
11 | Correct | 0 ms | 204 KB | Output is correct |
12 | Correct | 0 ms | 204 KB | Output is correct |
13 | Correct | 0 ms | 312 KB | Output is correct |
14 | Correct | 0 ms | 204 KB | Output is correct |
15 | Correct | 0 ms | 204 KB | Output is correct |
16 | Correct | 1 ms | 204 KB | Output is correct |
17 | Correct | 1 ms | 204 KB | Output is correct |
18 | Correct | 1 ms | 204 KB | Output is correct |
19 | Correct | 1 ms | 204 KB | Output is correct |
20 | Correct | 2 ms | 328 KB | Output is correct |
21 | Correct | 1 ms | 332 KB | Output is correct |
22 | Correct | 1 ms | 332 KB | Output is correct |
23 | Correct | 1 ms | 332 KB | Output is correct |
24 | Correct | 2 ms | 332 KB | Output is correct |
25 | Correct | 2 ms | 332 KB | Output is correct |
26 | Correct | 1 ms | 332 KB | Output is correct |
27 | Correct | 1 ms | 356 KB | Output is correct |
28 | Correct | 2 ms | 356 KB | Output is correct |
29 | Correct | 1 ms | 332 KB | Output is correct |
30 | Correct | 1 ms | 332 KB | Output is correct |
31 | Correct | 1 ms | 332 KB | Output is correct |
32 | Correct | 1 ms | 332 KB | Output is correct |
33 | Correct | 1 ms | 204 KB | Output is correct |
34 | Correct | 1 ms | 332 KB | Output is correct |
35 | Correct | 1 ms | 320 KB | Output is correct |
36 | Correct | 1 ms | 332 KB | Output is correct |
37 | Correct | 1 ms | 332 KB | Output is correct |
38 | Correct | 73 ms | 9088 KB | Output is correct |
39 | Correct | 64 ms | 8988 KB | Output is correct |
40 | Correct | 60 ms | 9092 KB | Output is correct |
41 | Correct | 69 ms | 9016 KB | Output is correct |
42 | Correct | 75 ms | 9024 KB | Output is correct |
43 | Correct | 77 ms | 9052 KB | Output is correct |
44 | Correct | 63 ms | 9012 KB | Output is correct |
45 | Correct | 73 ms | 9020 KB | Output is correct |
46 | Correct | 66 ms | 9036 KB | Output is correct |
47 | Correct | 83 ms | 8572 KB | Output is correct |
48 | Correct | 71 ms | 8552 KB | Output is correct |
49 | Correct | 57 ms | 6800 KB | Output is correct |
50 | Correct | 50 ms | 6740 KB | Output is correct |
51 | Correct | 86 ms | 9020 KB | Output is correct |
52 | Correct | 86 ms | 9088 KB | Output is correct |
53 | Correct | 90 ms | 8964 KB | Output is correct |
54 | Correct | 57 ms | 9024 KB | Output is correct |
55 | Correct | 69 ms | 9036 KB | Output is correct |
56 | Correct | 63 ms | 7680 KB | Output is correct |
57 | Correct | 19 ms | 1576 KB | Output is correct |
58 | Correct | 48 ms | 7676 KB | Output is correct |
59 | Correct | 71 ms | 7656 KB | Output is correct |
60 | Correct | 16 ms | 1680 KB | Output is correct |
61 | Correct | 34 ms | 4244 KB | Output is correct |
62 | Correct | 84 ms | 9172 KB | Output is correct |
63 | Correct | 107 ms | 8980 KB | Output is correct |
64 | Correct | 80 ms | 9048 KB | Output is correct |
65 | Correct | 79 ms | 9016 KB | Output is correct |
66 | Correct | 87 ms | 9088 KB | Output is correct |
67 | Correct | 99 ms | 9024 KB | Output is correct |
68 | Correct | 97 ms | 8996 KB | Output is correct |
69 | Correct | 82 ms | 9028 KB | Output is correct |
70 | Correct | 91 ms | 9196 KB | Output is correct |
71 | Correct | 108 ms | 9020 KB | Output is correct |
72 | Correct | 70 ms | 9024 KB | Output is correct |
73 | Correct | 64 ms | 9088 KB | Output is correct |