#include <bits/stdc++.h>
using namespace std;
typedef long long int lo;
typedef pair< int,int > PII;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid (start+end)/2
const lo inf = 1000000000000000000;
const int mod = 1000000007;
const int KOK = 100000;
const int li = 100005;
const int LOG = 20;
lo n,m,cev,x,k,a[li],tree[4*li],pre[li];
vector<int> v;
pair<lo,lo> p[li];
pair<lo,lo> pp[li];
char c;
string s;
void build(lo node,lo start,lo end){
if(start==end){tree[node]=p[start].se;return ;}
build(node*2,start,mid),build(node*2+1,mid+1,end);
tree[node]=min(tree[node*2],tree[node*2+1]);
}
void update(lo node,lo start,lo end,lo l,lo r,lo val){
cout<<"**\n";
if(start>end || start>r || end<l) return ;
if(start>=l && end<=r){tree[node]=val;return ;}
update(node*2,start,mid,l,r,val),update(node*2+1,mid+1,end,l,r,val);
tree[node]=min(tree[node*2],tree[node*2+1]);
}
lo query(lo node,lo start,lo end,lo l,lo r){
if(start>end || start>r || end<l) return inf;
if(start>=l && end<=r) return tree[node];
return min(query(node*2,start,mid,l,r),query(node*2+1,mid+1,end,l,r));
}
int main(){
scanf("%lld %lld",&n,&m);
FOR{
scanf("%lld %lld",&p[i].se,&p[i].fi);
//~ p[i].se.se=ie
}
sort(p+1,p+n+1);
reverse(p+1,p+n+1);
for(lo i=1;i<=m;i++){
scanf("%lld",&a[i]);
}
sort(a+1,a+m+1);
reverse(a+1,a+m+1);
lo ans=1;
for(lo i=1;i<=n && ans<=m;i++){
if(p[i].se<=a[ans]){cev++;ans++;}
}
printf("%lld\n",cev);
return 0;
}
Compilation message
joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:50:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld %lld",&n,&m);
~~~~~^~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:52:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld %lld",&p[i].se,&p[i].fi);
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:58:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld",&a[i]);
~~~~~^~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
288 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
4 ms |
384 KB |
Output is correct |
11 |
Correct |
4 ms |
384 KB |
Output is correct |
12 |
Correct |
4 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
4 ms |
384 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
19 |
Correct |
4 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
288 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
4 ms |
384 KB |
Output is correct |
11 |
Correct |
4 ms |
384 KB |
Output is correct |
12 |
Correct |
4 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
4 ms |
384 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
19 |
Correct |
4 ms |
384 KB |
Output is correct |
20 |
Correct |
5 ms |
384 KB |
Output is correct |
21 |
Correct |
6 ms |
384 KB |
Output is correct |
22 |
Correct |
5 ms |
384 KB |
Output is correct |
23 |
Correct |
6 ms |
384 KB |
Output is correct |
24 |
Correct |
5 ms |
384 KB |
Output is correct |
25 |
Correct |
6 ms |
384 KB |
Output is correct |
26 |
Correct |
6 ms |
384 KB |
Output is correct |
27 |
Correct |
5 ms |
384 KB |
Output is correct |
28 |
Correct |
5 ms |
384 KB |
Output is correct |
29 |
Correct |
5 ms |
384 KB |
Output is correct |
30 |
Correct |
5 ms |
384 KB |
Output is correct |
31 |
Correct |
5 ms |
384 KB |
Output is correct |
32 |
Correct |
5 ms |
384 KB |
Output is correct |
33 |
Correct |
5 ms |
384 KB |
Output is correct |
34 |
Correct |
5 ms |
384 KB |
Output is correct |
35 |
Correct |
5 ms |
384 KB |
Output is correct |
36 |
Correct |
5 ms |
384 KB |
Output is correct |
37 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
288 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
4 ms |
384 KB |
Output is correct |
11 |
Correct |
4 ms |
384 KB |
Output is correct |
12 |
Correct |
4 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
4 ms |
384 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
19 |
Correct |
4 ms |
384 KB |
Output is correct |
20 |
Correct |
5 ms |
384 KB |
Output is correct |
21 |
Correct |
6 ms |
384 KB |
Output is correct |
22 |
Correct |
5 ms |
384 KB |
Output is correct |
23 |
Correct |
6 ms |
384 KB |
Output is correct |
24 |
Correct |
5 ms |
384 KB |
Output is correct |
25 |
Correct |
6 ms |
384 KB |
Output is correct |
26 |
Correct |
6 ms |
384 KB |
Output is correct |
27 |
Correct |
5 ms |
384 KB |
Output is correct |
28 |
Correct |
5 ms |
384 KB |
Output is correct |
29 |
Correct |
5 ms |
384 KB |
Output is correct |
30 |
Correct |
5 ms |
384 KB |
Output is correct |
31 |
Correct |
5 ms |
384 KB |
Output is correct |
32 |
Correct |
5 ms |
384 KB |
Output is correct |
33 |
Correct |
5 ms |
384 KB |
Output is correct |
34 |
Correct |
5 ms |
384 KB |
Output is correct |
35 |
Correct |
5 ms |
384 KB |
Output is correct |
36 |
Correct |
5 ms |
384 KB |
Output is correct |
37 |
Correct |
5 ms |
384 KB |
Output is correct |
38 |
Correct |
75 ms |
5624 KB |
Output is correct |
39 |
Correct |
101 ms |
5496 KB |
Output is correct |
40 |
Correct |
65 ms |
5528 KB |
Output is correct |
41 |
Correct |
75 ms |
5504 KB |
Output is correct |
42 |
Correct |
82 ms |
5624 KB |
Output is correct |
43 |
Correct |
74 ms |
5500 KB |
Output is correct |
44 |
Correct |
74 ms |
5624 KB |
Output is correct |
45 |
Correct |
74 ms |
5496 KB |
Output is correct |
46 |
Correct |
70 ms |
5496 KB |
Output is correct |
47 |
Correct |
70 ms |
5112 KB |
Output is correct |
48 |
Correct |
65 ms |
5112 KB |
Output is correct |
49 |
Correct |
62 ms |
4536 KB |
Output is correct |
50 |
Correct |
61 ms |
4472 KB |
Output is correct |
51 |
Correct |
76 ms |
5624 KB |
Output is correct |
52 |
Correct |
77 ms |
5624 KB |
Output is correct |
53 |
Correct |
74 ms |
5496 KB |
Output is correct |
54 |
Correct |
57 ms |
5624 KB |
Output is correct |
55 |
Correct |
72 ms |
5624 KB |
Output is correct |
56 |
Correct |
48 ms |
3832 KB |
Output is correct |
57 |
Correct |
31 ms |
2048 KB |
Output is correct |
58 |
Correct |
48 ms |
3936 KB |
Output is correct |
59 |
Correct |
50 ms |
3884 KB |
Output is correct |
60 |
Correct |
31 ms |
2176 KB |
Output is correct |
61 |
Correct |
46 ms |
3296 KB |
Output is correct |
62 |
Correct |
75 ms |
5624 KB |
Output is correct |
63 |
Correct |
76 ms |
5628 KB |
Output is correct |
64 |
Correct |
76 ms |
5624 KB |
Output is correct |
65 |
Correct |
78 ms |
5624 KB |
Output is correct |
66 |
Correct |
75 ms |
5624 KB |
Output is correct |
67 |
Correct |
75 ms |
5628 KB |
Output is correct |
68 |
Correct |
75 ms |
5628 KB |
Output is correct |
69 |
Correct |
77 ms |
5628 KB |
Output is correct |
70 |
Correct |
86 ms |
5624 KB |
Output is correct |
71 |
Correct |
74 ms |
5624 KB |
Output is correct |
72 |
Correct |
74 ms |
5624 KB |
Output is correct |
73 |
Correct |
72 ms |
5624 KB |
Output is correct |