mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-24 03:11:58 +00:00
parent
34179a97a2
commit
6f733038c4
44
S2OJ/1562/1562.cpp
Normal file
44
S2OJ/1562/1562.cpp
Normal file
@ -0,0 +1,44 @@
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <set>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
const int N = 1e5 + 5;
|
||||
|
||||
int n, k, ans;
|
||||
std::pair<int, int> a[N];
|
||||
std::multiset<int> set;
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
cin >> n >> k;
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
cin >> a[i].first >> a[i].second;
|
||||
}
|
||||
|
||||
std::sort(a + 1, a + 1 + n, [&](const std::pair<int, int> &a, const std::pair<int, int> &b) {
|
||||
return a.second < b.second;
|
||||
});
|
||||
|
||||
for (int i = 1; i <= k; i++) set.insert(0);
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
auto it = set.upper_bound(a[i].first);
|
||||
|
||||
if (it != set.begin()) {
|
||||
set.erase(--it);
|
||||
set.insert(a[i].second);
|
||||
ans++;
|
||||
}
|
||||
}
|
||||
|
||||
cout << ans << endl;
|
||||
|
||||
return 0;
|
||||
}
|
BIN
S2OJ/1562/data/problem.conf
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/problem.conf
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv1.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv1.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv1.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv10.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv10.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv10.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv11.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv11.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv11.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv11.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv12.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv12.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv12.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv12.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv13.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv13.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv13.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv13.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv14.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv14.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv14.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv14.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv15.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv15.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv15.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv15.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv16.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv16.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv16.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv16.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv17.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv17.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv17.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv17.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv18.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv18.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv18.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv18.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv19.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv19.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv19.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv19.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv2.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv2.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv2.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv20.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv20.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv20.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv20.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv21.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv21.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv21.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv21.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv22.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv22.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv22.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv22.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv23.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv23.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv23.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv23.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv24.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv24.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv24.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv24.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv25.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv25.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv25.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv25.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv26.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv26.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv26.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv26.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv27.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv27.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv27.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv27.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv28.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv28.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv28.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv28.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv29.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv29.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv29.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv29.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv3.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv3.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv3.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv30.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv30.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv30.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv30.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv31.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv31.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv31.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv31.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv4.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv4.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv4.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv5.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv5.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv5.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv6.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv6.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv6.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv7.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv7.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv7.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv8.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv8.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv8.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv9.in
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
S2OJ/1562/data/tv9.out
(Stored with Git LFS)
Normal file
BIN
S2OJ/1562/data/tv9.out
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user