Submission #860439

# Submission time Handle Problem Language Result Execution time Memory
860439 2023-10-13T02:32:46 Z nnhzzz Exhibition (JOI19_ho_t2) C++14
100 / 100
46 ms 10020 KB
#include<bits/stdc++.h>

using namespace std;

#define REP(i,a,b) for(int i = (a); i<=(b); ++i)
#define REPD(i,a,b) for(int i = (a); i>=(b); --i)
#define REPDIS(i,a,b,c) for(int i = (a); i<=(b); i += c)
#define task "test"
#define task1 "nnhzzz"
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) (int)(x).size()
#define MASK(x) (1LL<<x)
#define BIT(x,i) ((x>>i)&1LL)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vpii vector<pii>
#define fi first
#define se second
#define ld long double
#define ll long long
#define int ll

//-------------------------------------------------------------------------------//
template<typename T> bool mini(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> bool maxi(T &a, T b){if(a<b){a=b;return true;}return false;}
//-------------------------------------------------------------------------------//
const int MAXN = 5e5+7,N = 1e5+7,inf = 1e9,LOG = 20;
const int MOD = 1e9+7,MOD1 = 123456789;
//-------------------------------------------------------------------------------//

pii a[MAXN];
int c[MAXN];

void solve(){
    int n,m; cin >> n >> m;
    REP(i,0,n-1) cin >> a[i].se >> a[i].fi;
    REP(i,0,m-1) cin >> c[i];
    sort(a,a+n); sort(c,c+m);
    int res = 0,j = m-1;
    REPD(i,n-1,0){
        if(j==-1) break;
        if(a[i].se<=c[j]){
            --j; ++res;
        }
    }
    cout << res;
}

signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    if(fopen(task".inp","r")){
        freopen(task".inp","r",stdin);
        freopen(task".out","w",stdout);
    }
    if(fopen(task1".inp","r")){
        freopen(task1".inp","r",stdin);
        freopen(task1".out","w",stdout);
    }
    solve();
    return 0;
}

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:54:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   54 |         freopen(task".inp","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:55:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   55 |         freopen(task".out","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:58:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   58 |         freopen(task1".inp","r",stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:59:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   59 |         freopen(task1".out","w",stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 0 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2392 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 0 ms 2508 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 0 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2392 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 0 ms 2508 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 1 ms 2396 KB Output is correct
26 Correct 1 ms 2648 KB Output is correct
27 Correct 1 ms 2392 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
29 Correct 1 ms 2396 KB Output is correct
30 Correct 1 ms 2396 KB Output is correct
31 Correct 1 ms 2524 KB Output is correct
32 Correct 1 ms 2392 KB Output is correct
33 Correct 1 ms 2396 KB Output is correct
34 Correct 1 ms 2396 KB Output is correct
35 Correct 1 ms 2396 KB Output is correct
36 Correct 1 ms 2396 KB Output is correct
37 Correct 1 ms 2392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 0 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 1 ms 2392 KB Output is correct
18 Correct 1 ms 2396 KB Output is correct
19 Correct 0 ms 2508 KB Output is correct
20 Correct 1 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 1 ms 2396 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 1 ms 2396 KB Output is correct
26 Correct 1 ms 2648 KB Output is correct
27 Correct 1 ms 2392 KB Output is correct
28 Correct 1 ms 2396 KB Output is correct
29 Correct 1 ms 2396 KB Output is correct
30 Correct 1 ms 2396 KB Output is correct
31 Correct 1 ms 2524 KB Output is correct
32 Correct 1 ms 2392 KB Output is correct
33 Correct 1 ms 2396 KB Output is correct
34 Correct 1 ms 2396 KB Output is correct
35 Correct 1 ms 2396 KB Output is correct
36 Correct 1 ms 2396 KB Output is correct
37 Correct 1 ms 2392 KB Output is correct
38 Correct 40 ms 10020 KB Output is correct
39 Correct 33 ms 9564 KB Output is correct
40 Correct 31 ms 9540 KB Output is correct
41 Correct 38 ms 9452 KB Output is correct
42 Correct 37 ms 9528 KB Output is correct
43 Correct 35 ms 9676 KB Output is correct
44 Correct 36 ms 9680 KB Output is correct
45 Correct 35 ms 9552 KB Output is correct
46 Correct 42 ms 9588 KB Output is correct
47 Correct 32 ms 9308 KB Output is correct
48 Correct 31 ms 9308 KB Output is correct
49 Correct 29 ms 9060 KB Output is correct
50 Correct 29 ms 9012 KB Output is correct
51 Correct 37 ms 9564 KB Output is correct
52 Correct 35 ms 9552 KB Output is correct
53 Correct 42 ms 9624 KB Output is correct
54 Correct 37 ms 9468 KB Output is correct
55 Correct 35 ms 9564 KB Output is correct
56 Correct 21 ms 6480 KB Output is correct
57 Correct 14 ms 5468 KB Output is correct
58 Correct 22 ms 6236 KB Output is correct
59 Correct 25 ms 6424 KB Output is correct
60 Correct 14 ms 5468 KB Output is correct
61 Correct 22 ms 8280 KB Output is correct
62 Correct 35 ms 9588 KB Output is correct
63 Correct 36 ms 9712 KB Output is correct
64 Correct 36 ms 9676 KB Output is correct
65 Correct 36 ms 9672 KB Output is correct
66 Correct 35 ms 9668 KB Output is correct
67 Correct 36 ms 9556 KB Output is correct
68 Correct 36 ms 9572 KB Output is correct
69 Correct 43 ms 9776 KB Output is correct
70 Correct 37 ms 9584 KB Output is correct
71 Correct 35 ms 9852 KB Output is correct
72 Correct 46 ms 9540 KB Output is correct
73 Correct 36 ms 9600 KB Output is correct