답안 #735878

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
735878 2023-05-04T21:25:28 Z JellyTheOctopus Exhibition (JOI19_ho_t2) C++17
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>
using namespace std;

#define f first
#define s second

bool cmp(pair<int, int> A, pair<int, int> B) {
	if (A.f == B.f) {
		return A.s > B.s;
	}
	return A.f < B.f;
}

int N, M;
vector<pair<int, int>> P;
vector<int> C;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin >> N >> M;
	P.resize(N);
	C.resize(M);
	for (int i = 0; i < N; i++) {
		cin >> P[i].s >> P[i].f;
	}
	for (int i = 0; i < M; i++) {
		cin >> C[i];
	}
	sort(P.begin(), P.end(), cmp);
	sort(C.begin(), C.end());
	int i = 0;
	int j = 0;
	int ans = 0;
	while (i < N && j < M) {
		bool flag = false;
		while (P[i].s > C[j]) {
			j++;
			if (j == M) {
				flag = true;
				break;
			}
		}
		if (flag) break;
		ans++;
		j++;
		i++;
	}
	cout << ans << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -