Submission #643472

# Submission time Handle Problem Language Result Execution time Memory
643472 2022-09-22T06:05:22 Z Baytoro Exhibition (JOI19_ho_t2) C++17
100 / 100
57 ms 5580 KB
#include <bits/stdc++.h>
using namespace std;
//#ifndef EVAL
//#include "grader.h"
//#endif
#define Baytoro_MayrambekovOrz void solve()
#define ios ios::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fr first
#define sc second
#define int long long
#define endl '\n'
#define yes cout<<"YES\n";
#define no cout<<"NO\n";
void fopn(string name){
	freopen((name+".in").c_str(),"r",stdin);
	freopen((name+".out").c_str(),"w",stdout);
}
int binpow(int a,int n){
	if(n==0)
		return 1;
	if(n%2==1)
		return binpow(a, n-1)*a;
	else{
		int b=binpow(a, n/2);
		return b*b;
	}
}
bool cmp(pair<int,int> a, pair<int,int> b){
	if(a.sc==b.sc)
		return a.fr<b.fr;
	return a.sc<b.sc;
}
int a,b,c,n,m,i,j,k,x,y,cnt=0,sum=0,res=0;
Baytoro_MayrambekovOrz{
	cin>>n>>m;
	vector<pair<int,int>> vec(n);
	vector<int> r(m);
	for(i=0;i<n;i++)
		cin>>vec[i].fr>>vec[i].sc;
	for(i=0;i<m;i++)
		cin>>r[i];
	sort(all(vec),cmp);
	sort(all(r));
	int id=m-1;
	res=0;
	for(i=n-1;i>=0 && id>=0;i--){
		if(r[id]>=vec[i].fr){
			id--;
			res++;
		}
	}
	cout<<res<<endl;
}
main(){
	ios;
	int T=1;
	//cin>>T;
	while(T--){
		solve();
	}
}

Compilation message

joi2019_ho_t2.cpp:57:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   57 | main(){
      | ^~~~
joi2019_ho_t2.cpp: In function 'void fopn(std::string)':
joi2019_ho_t2.cpp:18:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |  freopen((name+".in").c_str(),"r",stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:19:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |  freopen((name+".out").c_str(),"w",stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 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 0 ms 316 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 316 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 324 KB Output is correct
17 Correct 0 ms 212 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 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 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 0 ms 316 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 316 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 324 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 376 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 2 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 332 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 340 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 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 0 ms 316 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 316 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 324 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 376 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 2 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 332 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 340 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 332 KB Output is correct
38 Correct 49 ms 5464 KB Output is correct
39 Correct 47 ms 5476 KB Output is correct
40 Correct 41 ms 5472 KB Output is correct
41 Correct 45 ms 5560 KB Output is correct
42 Correct 49 ms 5472 KB Output is correct
43 Correct 57 ms 5568 KB Output is correct
44 Correct 45 ms 5468 KB Output is correct
45 Correct 44 ms 5476 KB Output is correct
46 Correct 47 ms 5452 KB Output is correct
47 Correct 41 ms 4940 KB Output is correct
48 Correct 42 ms 4988 KB Output is correct
49 Correct 38 ms 4480 KB Output is correct
50 Correct 36 ms 4372 KB Output is correct
51 Correct 45 ms 5468 KB Output is correct
52 Correct 44 ms 5572 KB Output is correct
53 Correct 47 ms 5516 KB Output is correct
54 Correct 39 ms 5580 KB Output is correct
55 Correct 45 ms 5468 KB Output is correct
56 Correct 30 ms 3784 KB Output is correct
57 Correct 16 ms 2000 KB Output is correct
58 Correct 28 ms 3792 KB Output is correct
59 Correct 30 ms 3800 KB Output is correct
60 Correct 18 ms 2004 KB Output is correct
61 Correct 34 ms 3176 KB Output is correct
62 Correct 46 ms 5464 KB Output is correct
63 Correct 44 ms 5568 KB Output is correct
64 Correct 45 ms 5468 KB Output is correct
65 Correct 47 ms 5564 KB Output is correct
66 Correct 46 ms 5452 KB Output is correct
67 Correct 47 ms 5560 KB Output is correct
68 Correct 46 ms 5484 KB Output is correct
69 Correct 46 ms 5476 KB Output is correct
70 Correct 47 ms 5468 KB Output is correct
71 Correct 46 ms 5560 KB Output is correct
72 Correct 53 ms 5464 KB Output is correct
73 Correct 46 ms 5460 KB Output is correct