답안 #884787

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
884787 2023-12-08T12:16:55 Z banhcuon14 Exhibition (JOI19_ho_t2) C++14
0 / 100
0 ms 348 KB
#include <cstdio>
#include <algorithm>
using namespace std;
 
int main() {
	int N, M, S, V;
	scanf("%d%d", &N, &M);
	int C[M];
	pair<int, int> paints[N];  //first V, second S
	for(int i = 0; i < N; i++) {
		scanf("%d%d", &S, &V);
		paints[i] = make_pair(V, S);
	}
	for(int i = 0; i < M; i++) {
		scanf("%d", C + i);
	}
	sort(paints, paints + N);
	sort(C, C + M);
	int ans = 0;
	for(int i = 0; i < N && ans < M; i++) {
		if(C[M - ans - 1] >= paints[i].second) {
			ans++;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Compilation message

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