답안 #129386

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
129386 2019-07-12T07:40:06 Z hungcung Exhibition (JOI19_ho_t2) C++17
0 / 100
2 ms 380 KB
#include<bits/stdc++.h>
using namespace std;
int n,m,c[100005],dem,ans;
pair<int,int> a[100005];
bool cmp(pair<int,int> &x,pair<int,int> &y){
	return x.second<y.second;
}
signed main(){
	scanf("%d %d",&n,&m);
	for(int i=0;i<n;i++){
		scanf("%d %d",&a[i].first,&a[i].second);
	}
	for(int i=0;i<m;i++){
		scanf("%d",&c[i]);
	}
	sort(a,a+n,cmp);
	sort(c,c+m);
	dem=n-1;
	for(int i=m-1;i>=0;i--){
		while(dem>=0&&a[dem].first>c[i]){
			dem--;
		}
		if(dem>=0){
			ans++;
			dem--;
		}
	}
	printf("%d",ans);
}

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:9: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:11:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d",&a[i].first,&a[i].second);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:14:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&c[i]);
   ~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Incorrect 2 ms 380 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Incorrect 2 ms 380 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Incorrect 2 ms 380 KB Output isn't correct
4 Halted 0 ms 0 KB -