제출 #152307

#제출 시각아이디문제언어결과실행 시간메모리
152307ivandasfsExhibition (JOI19_ho_t2)C++14
100 / 100
86 ms5100 KiB
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

vector <int> f;
vector <pair<int, int> > p;

int main() {
	int n, m;
	scanf("%d %d", &n, &m);
	for (int i=0 ; i<n ; i++) {
		int x,y;
		scanf("%d %d", &x, &y);
		p.push_back(make_pair(y, x));
	}
	for (int i=0 ; i<m ; i++) {
		int x;
		scanf("%d", &x);
		f.push_back(x);
	}
	sort(f.rbegin(), f.rend());
	sort(p.rbegin(), p.rend());
	int pos = 0;
	int sol = 0;
	for (int i=0 ; i<m ; i++) {
		if (pos==n) break;
		while (p[pos].second>f[i]) {
			pos++;
			if (pos==n) {
				printf("%d\n", sol);
				return 0;
			}
		}
		sol++;
		pos++;
	}
	printf("%d\n", sol);
	return 0;
}

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

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:13: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:16:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &x, &y);
   ~~~~~^~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:21:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &x);
   ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...