mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-24 03:31:59 +00:00
3709. [PA2014] Bohater
https://hydro.ac/d/bzoj/record/633e41aa6d08baa0485ddaaa
This commit is contained in:
parent
d146a7912d
commit
d6c433a1ea
73
BZOJ/3709/3709.cpp
Normal file
73
BZOJ/3709/3709.cpp
Normal file
@ -0,0 +1,73 @@
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <tuple>
|
||||
#include <vector>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
int n;
|
||||
long long k;
|
||||
std::vector<std::tuple<int, long long, long long>> up, down;
|
||||
std::vector<int> ans;
|
||||
|
||||
cin >> n >> k;
|
||||
|
||||
for (int i = 1, a, b; i <= n; i++) {
|
||||
cin >> a >> b;
|
||||
|
||||
if (b - a >= 0) up.emplace_back(i, a, b);
|
||||
else down.emplace_back(i, a, b);
|
||||
}
|
||||
|
||||
std::sort(up.begin(), up.end(), [&](const auto &a, const auto &b) {
|
||||
return std::get<1>(a) < std::get<1>(b);
|
||||
});
|
||||
|
||||
std::sort(down.begin(), down.end(), [&](const auto &a, const auto &b) {
|
||||
return std::get<2>(a) > std::get<2>(b);
|
||||
});
|
||||
|
||||
for (auto o : up) {
|
||||
k -= std::get<1>(o);
|
||||
|
||||
if (k <= 0) {
|
||||
cout << "NIE" << endl;
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
k += std::get<2>(o);
|
||||
}
|
||||
|
||||
for (auto o : down) {
|
||||
k -= std::get<1>(o);
|
||||
|
||||
if (k <= 0) {
|
||||
cout << "NIE" << endl;
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
k += std::get<2>(o);
|
||||
}
|
||||
|
||||
cout << "TAK" << endl;
|
||||
|
||||
for (auto o : up) {
|
||||
cout << std::get<0>(o) << ' ';
|
||||
}
|
||||
|
||||
for (auto o : down) {
|
||||
cout << std::get<0>(o) << ' ';
|
||||
}
|
||||
|
||||
cout << endl;
|
||||
|
||||
return 0;
|
||||
}
|
BIN
BZOJ/3709/data/1.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/1.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/1.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/10.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/10.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/10.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/11.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/11.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/11.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/11.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/12.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/12.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/12.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/12.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/13.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/13.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/13.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/13.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/14.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/14.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/14.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/14.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/15.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/15.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/15.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/15.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/16.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/16.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/16.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/16.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/17.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/17.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/17.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/17.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/18.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/18.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/18.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/18.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/19.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/19.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/19.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/19.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/2.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/2.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/2.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/20.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/20.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/20.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/20.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/21.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/21.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/21.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/21.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/22.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/22.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/22.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/22.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/23.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/23.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/23.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/23.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/24.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/24.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/24.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/24.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/25.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/25.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/25.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/25.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/26.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/26.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/26.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/26.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/27.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/27.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/27.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/27.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/28.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/28.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/28.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/28.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/29.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/29.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/29.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/29.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/3.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/3.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/3.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/30.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/30.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/30.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/30.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/31.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/31.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/31.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/31.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/32.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/32.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/32.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/32.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/33.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/33.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/33.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/33.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/34.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/34.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/34.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/34.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/35.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/35.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/35.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/35.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/36.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/36.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/36.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/36.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/37.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/37.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/37.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/37.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/38.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/38.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/38.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/38.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/39.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/39.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/39.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/39.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/4.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/4.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/4.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/40.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/40.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/40.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/40.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/41.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/41.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/41.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/41.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/42.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/42.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/42.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/42.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/43.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/43.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/43.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/43.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/44.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/44.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/44.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/44.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/45.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/45.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/45.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/45.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/46.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/46.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/46.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/46.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/47.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/47.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/47.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/47.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/48.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/48.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/48.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/48.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/49.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/49.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/49.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/49.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/5.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/5.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/5.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/50.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/50.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/50.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/50.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/51.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/51.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/51.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/51.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/52.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/52.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/52.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/52.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/53.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/53.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/53.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/53.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/3709/data/54.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/3709/data/54.in
(Stored with Git LFS)
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user