제출 #101337

#제출 시각아이디문제언어결과실행 시간메모리
101337DystoriaXExhibition (JOI19_ho_t2)C++14
100 / 100
95 ms4484 KiB
#include <bits/stdc++.h>

using namespace std;

int n, m;
vector<pair<int, int> > pic;
vector<int> c;

int main(){
	scanf("%d%d", &n, &m);

	pic.resize(n); c.resize(m);

	for(int i = 0; i < n; i++) scanf("%d%d", &pic[i].second, &pic[i].first);

	for(int i = 0; i < m; i++) scanf("%d", &c[i]);

	sort(pic.begin(), pic.end());
	sort(c.begin(), c.end());

	int it = n - 1;
	int ans = 0;

	for(int i = m - 1; i >= 0; i--){
		while(it >= 0 && c[i] < pic[it].second) it--;

		if(it < 0) break;
		ans++; it--;
	}

	printf("%d\n", ans);

	return 0;
}

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

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:10: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:14:34: 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", &pic[i].second, &pic[i].first);
                             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:16:34: 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]);
                             ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...