이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const long Nmax = 1e5 + 5;
long c[Nmax];
int n, m;
struct mang {
int first, second;
};
bool cmp(mang x, mang y) {
if (x.first == y.first) return x.second < y.second;
else return x.first < y.first;
}
int main() {
cin.tie(NULL) -> sync_with_stdio(false);
cin >> n >> m;
mang a[Nmax];
for (int i = 1; i <= n; ++i)
cin >> a[i].first >> a[i].second;
for (int j = 1; j <= m; ++j) cin >> c[j];
sort(a+1, a+n+1, cmp);
sort(c+1, c+m+1);
int ind = 1;
int ans = 1;
for (int i = 1; i <= m; ++i) {
while (ind <= n && a[ind].first > c[i]) ind++;
if (ind > n) break;
cout << ind << endl;
ans++;
ind++;
}
cout << ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |