답안 #735884

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
735884 2023-05-04T22:44:04 Z JellyTheOctopus Exhibition (JOI19_ho_t2) C++17
0 / 100
1 ms 224 KB
#include <bits/stdc++.h>
using namespace std;
 
#define f first
#define s second
 
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());
	sort(C.begin(), C.end());
	int curMax = INT_MAX;
	for (int i = N-1; i >= 0; i--) {
		if (P[i].s > curMax) {
			P[i].f = -1;
		}
		else {
			curMax = P[i].s;
		}
	}
	int i = 0;
	int j = 0;
	int ans = 0;
	while (i < N && j < M) {
		if (P[i].f == -1) {
			i++;
			continue;
		}
		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 1 ms 212 KB Output is correct
2 Correct 0 ms 224 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Incorrect 1 ms 212 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 224 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Incorrect 1 ms 212 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 224 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Incorrect 1 ms 212 KB Output isn't correct
6 Halted 0 ms 0 KB -