답안 #152994

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
152994 2019-09-11T05:39:46 Z junodeveloper Exhibition (JOI19_ho_t2) C++14
0 / 100
2 ms 256 KB
#include <bits/stdc++.h>
#define sz(x) ((int)x.size())
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int n,m,C[100010];
pii a[100010];
bool F(int x) {
	int i,j=m-x;
	for(i=0;i<n;i++) {
		if(j==m) break;
		if(a[i].se<=C[j]) j++;
	}
	return j==m;
}
int main() {
	scanf("%d%d",&n,&m);
	int i;
	for(i=0;i<n;i++) scanf("%d%d",&a[i].se,&a[i].fi);
	for(i=0;i<m;i++) scanf("%d",C+i);
	sort(a,a+n);
	int lo=0,hi=min(n,m);
	while(lo<hi) {
		int mid=(lo+hi+1)/2;
		if(F(mid)) lo=mid;
		else hi=mid-1;
	}
	printf("%d",lo);
	return 0;
}

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:22: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:24:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(i=0;i<n;i++) scanf("%d%d",&a[i].se,&a[i].fi);
                   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:25:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(i=0;i<m;i++) scanf("%d",C+i);
                   ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 252 KB Output is correct
2 Incorrect 2 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 252 KB Output is correct
2 Incorrect 2 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 252 KB Output is correct
2 Incorrect 2 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -