답안 #110471

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
110471 2019-05-10T21:33:13 Z sams Exhibition (JOI19_ho_t2) C++14
0 / 100
3 ms 256 KB
#include <bits/stdc++.h>

using namespace std;

const int maxn = 1e5+10;

struct pic{
	int s, v;
} in[maxn];

bool comp(pic a, pic b)
{
	if(a.v != b.v) return a.v < b.v;
	return a.s < b.s;
}
int n, m;
int mol[maxn];

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

	for(int i = 1 ; i <= n ; ++i) scanf("%d%d", &in[i].s, &in[i].s);
	for(int i = 1 ; i <= m ; ++i) scanf("%d", &mol[i]);
	
	sort(in + 1, in+n+1, comp);
	sort(mol+1, mol+m+1);
	
	int ans = 0, pos = n;

	for(int i = m ; i >= 1; --i)
	{
		for(; pos >= 1 && in[pos].s > mol[i]; pos--);

		if(pos >= 1)
		{
			ans++;
			pos--;
		}
	}
	printf("%d\n", ans);
  	return 0;
}

Compilation message

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