제출 #478559

#제출 시각아이디문제언어결과실행 시간메모리
478559MonkeyKingExhibition (JOI19_ho_t2)C++14
100 / 100
89 ms3212 KiB
#include <numeric>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#include <assert.h>
#include <bitset>
#include <time.h>
#define Endl endl
#define mp make_pair
#define mt make_tuple
#define ll long long 
#define ull unsigned long long
#define pii pair<int,int>
#define over(A) {cout<<A<<endl;exit(0);}
#define all(A) A.begin(),A.end()
#define quickcin ios_base::sync_with_stdio(false);
const int mod=1000000007;
const int gmod=3;
const int inf=1039074182;
const double eps=1e-9;
const double pi=3.141592653589793238462643383279;
const ll llinf=2LL*inf*inf;
template <typename T1,typename T2> inline void chmin(T1 &x,T2 b) {if(b<x) x=b;}
template <typename T1,typename T2> inline void chmax(T1 &x,T2 b) {if(b>x) x=b;}
inline void chadd(int &x,int b) {x+=b-mod;x+=(x>>31 & mod);}
template <typename T1,typename T2> inline void chadd(T1 &x,T2 b) {x+=b;if(x>=mod) x-=mod;}
template <typename T1,typename T2> inline void chmul(T1 &x,T2 b) {x=1LL*x*b%mod;}
template <typename T1,typename T2> inline void chmod(T1 &x,T2 b) {x%=b,x+=b;if(x>=b) x-=b;}
template <typename T> inline T mabs(T x) {return (x<0?-x:x);}
using namespace std;
int n,m;
vector<pii> vSort;
int b[100005];
int a[100005];

int main()
{
	// freopen("a.in","r",stdin);
	// freopen("a.out","w",stdout);
	cin>>n>>m;
	for(int i=0;i<n;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		vSort.emplace_back(y,x);
	}
	sort(all(vSort));
	for(int i=0;i<n;i++) a[i]=vSort[i].second;
	for(int i=0;i<m;i++) scanf("%d",b+i);
	sort(b,b+m);
	int res=0,pre=m;
	for(int i=n-1;i>=0;i--)
	{
		int pos=lower_bound(b,b+m,a[i])-b;
		if(pos>=pre) continue;
		pre--;
		res++;
	}
	cout<<res<<endl;
	return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:53:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   53 |   scanf("%d%d",&x,&y);
      |   ~~~~~^~~~~~~~~~~~~~
joi2019_ho_t2.cpp:58:28: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   58 |  for(int i=0;i<m;i++) scanf("%d",b+i);
      |                       ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...