Submission #97870

# Submission time Handle Problem Language Result Execution time Memory
97870 2019-02-19T08:20:35 Z AKaan37 Exhibition (JOI19_ho_t2) C++17
100 / 100
94 ms 2812 KB
#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_t3.cpp: In function 'int main()':
joi2019_ho_t3.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_t3.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_t3.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 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 412 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 304 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 3 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 412 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 304 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 3 ms 384 KB Output is correct
20 Correct 3 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 4 ms 384 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 3 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 3 ms 384 KB Output is correct
28 Correct 3 ms 384 KB Output is correct
29 Correct 3 ms 384 KB Output is correct
30 Correct 3 ms 384 KB Output is correct
31 Correct 3 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 3 ms 384 KB Output is correct
34 Correct 3 ms 384 KB Output is correct
35 Correct 2 ms 384 KB Output is correct
36 Correct 2 ms 384 KB Output is correct
37 Correct 3 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 412 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 304 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 3 ms 384 KB Output is correct
20 Correct 3 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 4 ms 384 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 3 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 3 ms 384 KB Output is correct
28 Correct 3 ms 384 KB Output is correct
29 Correct 3 ms 384 KB Output is correct
30 Correct 3 ms 384 KB Output is correct
31 Correct 3 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 3 ms 384 KB Output is correct
34 Correct 3 ms 384 KB Output is correct
35 Correct 2 ms 384 KB Output is correct
36 Correct 2 ms 384 KB Output is correct
37 Correct 3 ms 384 KB Output is correct
38 Correct 69 ms 2672 KB Output is correct
39 Correct 71 ms 2684 KB Output is correct
40 Correct 77 ms 2780 KB Output is correct
41 Correct 93 ms 2680 KB Output is correct
42 Correct 72 ms 2720 KB Output is correct
43 Correct 72 ms 2680 KB Output is correct
44 Correct 70 ms 2680 KB Output is correct
45 Correct 83 ms 2720 KB Output is correct
46 Correct 71 ms 2680 KB Output is correct
47 Correct 59 ms 2428 KB Output is correct
48 Correct 69 ms 2428 KB Output is correct
49 Correct 71 ms 2232 KB Output is correct
50 Correct 55 ms 2168 KB Output is correct
51 Correct 73 ms 2680 KB Output is correct
52 Correct 92 ms 2812 KB Output is correct
53 Correct 94 ms 2800 KB Output is correct
54 Correct 52 ms 2652 KB Output is correct
55 Correct 65 ms 2808 KB Output is correct
56 Correct 45 ms 2040 KB Output is correct
57 Correct 26 ms 1152 KB Output is correct
58 Correct 44 ms 2008 KB Output is correct
59 Correct 45 ms 2164 KB Output is correct
60 Correct 27 ms 1152 KB Output is correct
61 Correct 43 ms 1652 KB Output is correct
62 Correct 69 ms 2680 KB Output is correct
63 Correct 69 ms 2680 KB Output is correct
64 Correct 72 ms 2680 KB Output is correct
65 Correct 71 ms 2680 KB Output is correct
66 Correct 70 ms 2644 KB Output is correct
67 Correct 74 ms 2600 KB Output is correct
68 Correct 68 ms 2680 KB Output is correct
69 Correct 80 ms 2736 KB Output is correct
70 Correct 92 ms 2808 KB Output is correct
71 Correct 78 ms 2704 KB Output is correct
72 Correct 78 ms 2680 KB Output is correct
73 Correct 60 ms 2680 KB Output is correct