# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1271903 | AgentPengin | Exhibition (JOI19_ho_t2) | C++20 | 88 ms | 9436 KiB |
/**
* author: AgentPengin ( Độc cô cầu bại )
* created: 23.12.2022 10:08:02
* too lazy to update time
**/
#include<bits/stdc++.h>
#define EL '\n'
#define fi first
#define se second
#define NAME "TASK"
#define ll long long
#define lcm(a,b) (a/gcd(a,b))*b
#define db(val) "["#val" = " << (val) << "] "
#define bend(v) (v).begin(),(v).end()
#define sz(v) (int)(v).size()
#define ex exit(0)
#define int ll
using namespace std;
const ll mod = 1e9 + 7;
const int inf = 0x1FFFFFFF;
const int MAXN = 1e5 + 5;
struct Pic {
int s, v, id;
} p[MAXN];
int n, m, c[MAXN], pos[MAXN];
set<int> s;
signed main() {
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
if (ifstream(NAME".inp")) {
freopen(NAME".inp","r",stdin);
freopen(NAME".out","w",stdout);
}
cin >> n >> m;
for (int i = 1;i <= n;i++) {
cin >> p[i].s >> p[i].v;
p[i].id = i;
}
for (int i = 1;i <= m;i++) cin >> c[i];
sort(p + 1, p + n + 1, [&](const Pic& A, const Pic& B){
if (A.v == B.v) return A.s < B.s;
else return A.v < B.v;
});
for (int i = 1;i <= n;i++) {
pos[p[i].id] = i;
}
sort(p + 1, p + n + 1, [&](const Pic& A, const Pic& B){
return A.s < B.s;
});
sort(c + 1,c + m + 1);
int ans = 0;
for (int i = 1;i <= n;i++) s.insert(i);
int cur = n + 1, ptr = n;
for (int i = m;i >= 1;i--) {
while(c[i] < p[ptr].s && ptr > 0) {
if (s.find(pos[p[ptr].id]) != s.end()) {
s.erase(pos[p[ptr].id]);
}
ptr--;
}
auto it = s.lower_bound(cur);
if (it == s.begin()) break;
it--;
cur = *it;
ans++;
s.erase(it);
}
cout << ans;
cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
return 0;
}
// agent pengin wants to take apio (with anya-san)
컴파일 시 표준 에러 (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... |