QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#860466 | #9975. Hitoshizuku | ucup-team987# | WA | 60ms | 3712kb | C++26 | 2.3kb | 2025-01-18 13:30:58 | 2025-01-18 13:32:37 |
Judging History
answer
#if __INCLUDE_LEVEL__ == 0
#include __BASE_FILE__
void Solve() {
int n;
IN(n);
vector<int> a(3 * n), b(3 * n);
for (int i : Rep(0, 3 * n)) {
IN(a[i], b[i]);
}
vector<int> order(ALL(Rep(0, 3 * n)));
ranges::sort(order, {}, LAMBDA(i, pair(a[i], b[i])));
priority_queue q(greater{}, vector<pair<int, int>>{});
vector<array<int, 3>> ans;
ans.reserve(n);
for (int i : order) {
auto Check = [&]() -> bool {
if (Sz(q) < 2) {
return false;
}
return a[i] <= q.top().first;
};
if (Check()) {
int x = q.top().second;
q.pop();
int y = q.top().second;
q.pop();
ans.push_back({x + 1, y + 1, i + 1});
} else {
q.emplace(b[i], i);
}
}
if (Sz(q)) {
OUT("No");
return;
}
assert(Sz(ans) == n);
OUT("Yes");
ranges::for_each(ans, LIFT(OUT));
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
IN(t);
while (t--) {
Solve();
}
}
#elif __INCLUDE_LEVEL__ == 1
#include <bits/stdc++.h>
template <class T> concept Range = std::ranges::range<T> && !std::convertible_to<T, std::string_view>;
template <class T> concept Tuple = std::__is_tuple_like<T>::value && !Range<T>;
namespace std {
istream& operator>>(istream& is, Range auto&& r) {
for (auto&& e : r) is >> e;
return is;
}
istream& operator>>(istream& is, Tuple auto&& t) {
apply([&](auto&... xs) { (is >> ... >> xs); }, t);
return is;
}
ostream& operator<<(ostream& os, Range auto&& r) {
auto sep = "";
for (auto&& e : r) os << exchange(sep, " ") << e;
return os;
}
ostream& operator<<(ostream& os, Tuple auto&& t) {
auto sep = "";
apply([&](auto&... xs) { ((os << exchange(sep, " ") << xs), ...); }, t);
return os;
}
} // namespace std
using namespace std;
#define LAMBDA(x, ...) ([&](auto&& x) -> decltype(auto) { return __VA_ARGS__; })
#define LIFT(f) ([&](auto&&... xs) -> decltype(auto) { return f(forward<decltype(xs)>(xs)...); })
#define ALL(r) begin(r), end(r)
#define Rep(...) [](int l, int r) { return views::iota(min(l, r), r); }(__VA_ARGS__)
#define Sz(r) int(size(r))
#define IN(...) (cin >> forward_as_tuple(__VA_ARGS__))
#define OUT(...) (cout << forward_as_tuple(__VA_ARGS__) << '\n')
#endif // __INCLUDE_LEVEL__ == 1
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3712kb
input:
2 2 1 2 2 2 2 3 3 5 4 4 4 5 1 1 1 1 1000000000 1000000000 1000000000
output:
Yes 1 2 3 5 4 6 No
result:
ok >_< (2 test cases)
Test #2:
score: 0
Accepted
time: 60ms
memory: 3712kb
input:
100000 1 164154503 167959139 178382610 336470888 12298535 642802746 1 165064830 773386884 353585658 396628655 792066242 971207868 1 1607946 2087506 21674839 46761498 9518201 16843338 1 262361007 691952768 190585553 787375312 637191526 693319712 1 41970708 45277106 197619816 762263554 308360206 40724...
output:
No No No Yes 1 2 3 No Yes 2 1 3 No No No No No Yes 1 3 2 Yes 1 2 3 No No No No Yes 3 1 2 No Yes 3 1 2 No No Yes 3 1 2 No No Yes 3 1 2 No No No No No No No Yes 2 1 3 No No Yes 2 1 3 No No No No No No No No No No No No Yes 2 1 3 No No Yes 2 1 3 Yes 3 2 1 No No Yes 2 1 3 No No No Yes 1 3 2 Yes 2 1 3 No...
result:
ok >_< (100000 test cases)
Test #3:
score: -100
Wrong Answer
time: 50ms
memory: 3584kb
input:
50000 2 36364670 641009859 15071436 75475634 20446080 476927808 357784519 503158867 206641725 322595515 268011721 645468307 2 247717926 939887597 808609669 973764525 496738491 710156469 463547010 860350786 757388873 784695957 29903136 208427221 2 26681139 67590963 458238185 475357775 80127817 135993...
output:
No No No No No No No No No No No No Yes 5 3 1 6 2 4 No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No Yes 6 3 2 1 4 5 No No No Yes 3 6 5 4 1 2 No No Yes 6 3 5 1 4 2 Yes 5 6 2 1 3 4 No No Yes 4 6 3 5 1 2 No No No No Yes 5 2 3 1 4 6 No No No No No Yes 2 4 1 3...
result:
wrong answer There is a valid answer, but participant did not find it. (test case 30)