mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-24 03:31:59 +00:00
2794. [POI2012] Cloakroom
https://hydro.ac/d/bzoj/record/6322ee0c32ae6c3198cc9eee
This commit is contained in:
parent
487d68a098
commit
5ef3680762
64
BZOJ/2794/2794.cpp
Normal file
64
BZOJ/2794/2794.cpp
Normal file
@ -0,0 +1,64 @@
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
#include <tuple>
|
||||
|
||||
using std::cin;
|
||||
using std::cout;
|
||||
const char endl = '\n';
|
||||
|
||||
const int N = 1005,
|
||||
P = 1e6 + 5;
|
||||
|
||||
int n, p, f[P];
|
||||
bool ans[P];
|
||||
std::tuple<int, int, int> a[N];
|
||||
std::tuple<int, int, int, int> b[P];
|
||||
|
||||
int main() {
|
||||
std::ios::sync_with_stdio(false);
|
||||
cin.tie(nullptr);
|
||||
|
||||
cin >> n;
|
||||
|
||||
for (int i = 1; i <= n; i++) {
|
||||
cin >> std::get<2>(a[i]) >> std::get<0>(a[i]) >> std::get<1>(a[i]);
|
||||
}
|
||||
|
||||
std::sort(a + 1, a + 1 + n, [&](auto a, auto b) {
|
||||
return std::get<0>(a) < std::get<0>(b);
|
||||
});
|
||||
|
||||
cin >> p;
|
||||
|
||||
for (int i = 1; i <= p; i++) {
|
||||
cin >> std::get<1>(b[i]) >> std::get<2>(b[i]) >> std::get<3>(b[i]);
|
||||
std::get<0>(b[i]) = i;
|
||||
}
|
||||
|
||||
std::sort(b + 1, b + 1 + p, [&](auto a, auto b) {
|
||||
return std::get<1>(a) < std::get<1>(b);
|
||||
});
|
||||
|
||||
f[0] = std::numeric_limits<int>::max();
|
||||
for (int i = 1, j = 1; i <= p; i++) {
|
||||
while (std::get<0>(a[j]) <= std::get<1>(b[i]) && j <= n) {
|
||||
for (int k = 100000; k >= std::get<2>(a[j]); k--) {
|
||||
f[k] = std::max(f[k],
|
||||
std::min(f[k - std::get<2>(a[j])],
|
||||
std::get<1>(a[j])));
|
||||
}
|
||||
j++;
|
||||
}
|
||||
|
||||
if (f[std::get<2>(b[i])] > std::get<1>(b[i]) + std::get<3>(b[i])) {
|
||||
ans[std::get<0>(b[i])] = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 1; i <= p; i++) {
|
||||
cout << (ans[i] ? "TAK" : "NIE") << endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
BIN
BZOJ/2794/data/1.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/1.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/1.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/1.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/10.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/10.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/10.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/10.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/11.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/11.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/11.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/11.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/12.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/12.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/12.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/12.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/13.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/13.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/13.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/13.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/14.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/14.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/14.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/14.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/15.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/15.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/15.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/15.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/16.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/16.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/16.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/16.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/17.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/17.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/17.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/17.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/2.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/2.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/2.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/2.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/3.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/3.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/3.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/3.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/4.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/4.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/4.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/4.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/5.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/5.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/5.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/5.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/6.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/6.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/6.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/6.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/7.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/7.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/7.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/7.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/8.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/8.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/8.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/8.out
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/9.in
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/9.in
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
BZOJ/2794/data/9.out
(Stored with Git LFS)
Normal file
BIN
BZOJ/2794/data/9.out
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user