# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
529921 | kevin | Exhibition (JOI19_ho_t2) | C++17 | 108 ms | 9196 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define nl cout<<"\n"
#define all(x) x.begin(), x.end()
#define f first
#define s second
#define ca(v) for(auto i:v) cout<<i<<" ";
const int MOD = 1e9 + 7;
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
if (fopen("input.in", "r")) freopen("input.in", "r", stdin);
int n, m; cin>>n>>m;
vector<pair<int, int>> ar;
for(int i=0; i<n; i++){
int x, v;
cin>>x>>v;
ar.push_back({x, v});
}
vector<int> sz(m);
for(int i=0; i<m; i++) cin>>sz[i];
sort(all(ar));
sort(all(sz));
multiset<pair<int, int>> ms;
for(auto p:ar) ms.insert({p.s, p.f});
int ans = 0;
int last = 2e9;
for(int i=m-1; i>=0; i--){
while(ar.size() && ar.back().f > sz[i]) {
auto it = ms.find({ar.back().s, ar.back().f});
if(it != ms.end()) ms.erase(it);
ar.pop_back();
}
while(ms.size() && ms.rbegin()->f > last) ms.erase(--ms.end());
if(ms.size()){
ans++;
last = ms.rbegin()->f;
ms.erase(--ms.end());
}
}
cout<<ans;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |