Submission #727036

# Submission time Handle Problem Language Result Execution time Memory
727036 2023-04-19T21:27:06 Z Bogdan1110 Exhibition (JOI19_ho_t2) C++14
100 / 100
61 ms 4800 KB
#include <bits/stdc++.h>
#define FAST {ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
#define FILES {freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);}
#define ll long long
#define ull unsigned long long
#define pqueue priority_queue
#define pb push_back
#define fi first
#define se second
#define ld long double
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(a) (a).begin(), (a).end()
#define mp make_pair 
using namespace std;
// order_of_key -> # less than k
// find_by_order -> k-th element
// pq max element
 
void files() {
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}

const double eps = 0.00000001;
const int NMAX = 100010;
const ll inf = LLONG_MAX/3;
const ll modi = 998244353;

void solve() {
    int n,m;
    cin >> n >> m;
    
    vector<pii>v(n);
    vector<int>c(m,0);

    for (int i = 0; i < n ; i++ ) {
        cin >> v[i].se >> v[i].fi;
    }

    sort(all(v));

    for (int i = 0 ; i < m ; i++ ) {
        cin >> c[i];
    }

    sort(all(c));

    vector<int>res(n+1,INT_MAX);
    int cnt = m-1;
    for (int i = n-1 ; i >=0 ; i-- ) {
        if ( cnt < 0 ) break;
        if ( c[cnt] >= v[i].se ) {
            //cout << c[cnt] << ' ' << v[i].fi << ' ' << v[i].se << endl;
            cnt--;
        }
    }

    cout << m - cnt -1 << endl;

}

int main () { 
    FAST

    int t=1;

    /*
    cin >> t;
    //*/

    int i = 1;
    while(t--) {
        //cout << "Case #" << i++ << ": " ;
        solve();
    }
}  

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:74:9: warning: unused variable 'i' [-Wunused-variable]
   74 |     int i = 1;
      |         ^
joi2019_ho_t2.cpp: In function 'void files()':
joi2019_ho_t2.cpp:22:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   22 |         freopen("input.txt", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:23:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   23 |         freopen("output.txt", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 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 320 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 316 KB Output is correct
14 Correct 1 ms 320 KB Output is correct
15 Correct 0 ms 320 KB Output is correct
16 Correct 1 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 1 ms 212 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 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 320 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 316 KB Output is correct
14 Correct 1 ms 320 KB Output is correct
15 Correct 0 ms 320 KB Output is correct
16 Correct 1 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 2 ms 340 KB Output is correct
21 Correct 2 ms 336 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 2 ms 360 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 360 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 332 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 332 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 1 ms 332 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 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 320 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 316 KB Output is correct
14 Correct 1 ms 320 KB Output is correct
15 Correct 0 ms 320 KB Output is correct
16 Correct 1 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 2 ms 340 KB Output is correct
21 Correct 2 ms 336 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 2 ms 360 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 360 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 332 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 1 ms 332 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 1 ms 332 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 43 ms 4684 KB Output is correct
39 Correct 47 ms 4760 KB Output is correct
40 Correct 37 ms 4764 KB Output is correct
41 Correct 48 ms 4684 KB Output is correct
42 Correct 47 ms 4684 KB Output is correct
43 Correct 45 ms 4692 KB Output is correct
44 Correct 42 ms 4688 KB Output is correct
45 Correct 48 ms 4672 KB Output is correct
46 Correct 44 ms 4684 KB Output is correct
47 Correct 42 ms 4308 KB Output is correct
48 Correct 48 ms 4324 KB Output is correct
49 Correct 35 ms 3768 KB Output is correct
50 Correct 37 ms 3792 KB Output is correct
51 Correct 44 ms 4680 KB Output is correct
52 Correct 50 ms 4688 KB Output is correct
53 Correct 46 ms 4688 KB Output is correct
54 Correct 40 ms 4800 KB Output is correct
55 Correct 43 ms 4676 KB Output is correct
56 Correct 29 ms 3388 KB Output is correct
57 Correct 19 ms 1604 KB Output is correct
58 Correct 29 ms 3400 KB Output is correct
59 Correct 27 ms 3404 KB Output is correct
60 Correct 16 ms 1604 KB Output is correct
61 Correct 28 ms 2756 KB Output is correct
62 Correct 44 ms 4676 KB Output is correct
63 Correct 43 ms 4684 KB Output is correct
64 Correct 45 ms 4680 KB Output is correct
65 Correct 59 ms 4684 KB Output is correct
66 Correct 61 ms 4668 KB Output is correct
67 Correct 43 ms 4688 KB Output is correct
68 Correct 45 ms 4780 KB Output is correct
69 Correct 44 ms 4672 KB Output is correct
70 Correct 47 ms 4676 KB Output is correct
71 Correct 47 ms 4684 KB Output is correct
72 Correct 49 ms 4684 KB Output is correct
73 Correct 42 ms 4780 KB Output is correct