답안 #251754

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
251754 2020-07-22T09:19:15 Z jamielim Exhibition (JOI19_ho_t2) C++14
100 / 100
85 ms 4472 KB
//#include "lost.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;
typedef long double ld;
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ALL(x) x.begin(),x.end()
#define SZ(x) (int)x.size()
const int INF=2012345678;
const ll LLINF=4012345678012345678LL;
const ll MOD=1000000007; //998244353; //
const ld PI=3.1415926535898;
const ld EPS=1e-9;
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(b==0)return a;return gcd(b,a%b);}
inline ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline ll expo(ll b,ll p,ll m){ll res=1; while(p){if(p&1)res=(res*b)%m; b=(b*b)%m; p>>=1;} return res;}
inline ll modinv(ll a,ll m){return expo(a,m-2,m);}

int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	ii p[n];
	for(int i=0;i<n;i++)scanf("%d%d",&p[i].se,&p[i].fi);
	int c[m];
	for(int i=0;i<m;i++)scanf("%d",&c[i]);
	sort(p,p+n);sort(c,c+m);
	int l=0,r=min(n,m);
	while(l<r){
		int mid=(l+r+1)/2;
		int idx=0;
		bool poss=1;
		for(int i=m-mid;i<m;i++){
			while(idx<n&&p[idx].se>c[i])idx++;
			if(idx==n){poss=0;break;}
			idx++;
		}
		if(poss)l=mid;
		else r=mid-1;
	}
	printf("%d",l);
}

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:27:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&n,&m);
  ~~~~~^~~~~~~~~~~~~~
joi2019_ho_t2.cpp:29:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=0;i<n;i++)scanf("%d%d",&p[i].se,&p[i].fi);
                      ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:31:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=0;i<m;i++)scanf("%d",&c[i]);
                      ~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 372 KB Output is correct
6 Correct 0 ms 256 KB Output is correct
7 Correct 0 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 0 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 0 ms 256 KB Output is correct
18 Correct 0 ms 256 KB Output is correct
19 Correct 0 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 372 KB Output is correct
6 Correct 0 ms 256 KB Output is correct
7 Correct 0 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 0 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 0 ms 256 KB Output is correct
18 Correct 0 ms 256 KB Output is correct
19 Correct 0 ms 256 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 1 ms 384 KB Output is correct
28 Correct 1 ms 384 KB Output is correct
29 Correct 1 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 1 ms 384 KB Output is correct
32 Correct 1 ms 384 KB Output is correct
33 Correct 1 ms 384 KB Output is correct
34 Correct 1 ms 384 KB Output is correct
35 Correct 1 ms 384 KB Output is correct
36 Correct 1 ms 384 KB Output is correct
37 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 0 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
5 Correct 0 ms 372 KB Output is correct
6 Correct 0 ms 256 KB Output is correct
7 Correct 0 ms 256 KB Output is correct
8 Correct 0 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 0 ms 256 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 256 KB Output is correct
13 Correct 0 ms 256 KB Output is correct
14 Correct 0 ms 256 KB Output is correct
15 Correct 0 ms 256 KB Output is correct
16 Correct 0 ms 256 KB Output is correct
17 Correct 0 ms 256 KB Output is correct
18 Correct 0 ms 256 KB Output is correct
19 Correct 0 ms 256 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 1 ms 384 KB Output is correct
22 Correct 1 ms 384 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 1 ms 384 KB Output is correct
26 Correct 1 ms 384 KB Output is correct
27 Correct 1 ms 384 KB Output is correct
28 Correct 1 ms 384 KB Output is correct
29 Correct 1 ms 384 KB Output is correct
30 Correct 1 ms 384 KB Output is correct
31 Correct 1 ms 384 KB Output is correct
32 Correct 1 ms 384 KB Output is correct
33 Correct 1 ms 384 KB Output is correct
34 Correct 1 ms 384 KB Output is correct
35 Correct 1 ms 384 KB Output is correct
36 Correct 1 ms 384 KB Output is correct
37 Correct 1 ms 384 KB Output is correct
38 Correct 75 ms 4344 KB Output is correct
39 Correct 83 ms 4472 KB Output is correct
40 Correct 77 ms 4344 KB Output is correct
41 Correct 74 ms 4348 KB Output is correct
42 Correct 75 ms 4344 KB Output is correct
43 Correct 74 ms 4344 KB Output is correct
44 Correct 76 ms 4328 KB Output is correct
45 Correct 74 ms 4344 KB Output is correct
46 Correct 72 ms 4344 KB Output is correct
47 Correct 68 ms 3960 KB Output is correct
48 Correct 66 ms 3960 KB Output is correct
49 Correct 60 ms 3580 KB Output is correct
50 Correct 60 ms 3576 KB Output is correct
51 Correct 73 ms 4344 KB Output is correct
52 Correct 75 ms 4472 KB Output is correct
53 Correct 72 ms 4344 KB Output is correct
54 Correct 61 ms 4344 KB Output is correct
55 Correct 70 ms 4464 KB Output is correct
56 Correct 46 ms 3064 KB Output is correct
57 Correct 28 ms 1664 KB Output is correct
58 Correct 42 ms 3064 KB Output is correct
59 Correct 45 ms 3064 KB Output is correct
60 Correct 28 ms 1664 KB Output is correct
61 Correct 45 ms 2556 KB Output is correct
62 Correct 79 ms 4344 KB Output is correct
63 Correct 79 ms 4344 KB Output is correct
64 Correct 81 ms 4344 KB Output is correct
65 Correct 79 ms 4348 KB Output is correct
66 Correct 81 ms 4324 KB Output is correct
67 Correct 82 ms 4344 KB Output is correct
68 Correct 80 ms 4344 KB Output is correct
69 Correct 85 ms 4452 KB Output is correct
70 Correct 79 ms 4344 KB Output is correct
71 Correct 81 ms 4344 KB Output is correct
72 Correct 74 ms 4344 KB Output is correct
73 Correct 77 ms 4344 KB Output is correct