QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#862074 | #9975. Hitoshizuku | ucup-team139# | WA | 66ms | 3712kb | C++23 | 1.9kb | 2025-01-18 21:41:56 | 2025-01-18 21:42:19 |
Judging History
answer
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <assert.h>
#include <climits>
#include <iomanip>
using namespace std;
void solve([[maybe_unused]] int t)
{
int n;
cin >> n;
set<array<int, 3>> v, st, en;
for (int i = 1; i <= 3 * n; i++)
{
int a, b;
cin >> a >> b;
v.insert({a, b, i});
st.insert({a, b, i});
}
vector<array<int, 3>> sol;
while (!v.empty())
{
auto [l, r, i] = *v.begin();
v.erase(v.begin());
while (!st.empty() && (*st.begin())[0] <= r)
{
auto [l2, r2, i2] = *st.begin();
st.erase(st.begin());
en.insert({r2, l2, i2});
}
if (en.size() >= 3)
{
vector<array<int, 3>> tmp;
for (int i = 0; i < 3; i++)
{
tmp.push_back(*en.begin());
en.erase(en.begin());
}
sol.push_back({tmp[0][2], tmp[1][2], tmp[2][2]});
for (auto [r2, l2, i2] : tmp)
{
auto it = v.find({l2, r2, i2});
if (it != v.end())
v.erase(it);
}
}
else
{
cout << "No\n";
return;
}
}
cout << "Yes\n";
for (auto [a, b, c] : sol)
cout << a << " " << b << " " << c << "\n";
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int n = 1;
cin >> n;
for (int i = 1; i <= n; i++)
solve(i);
}
詳細信息
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: -100
Wrong Answer
time: 66ms
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:
Yes 1 2 3 No No Yes 1 3 2 No Yes 2 1 3 No No No No No Yes 2 1 3 Yes 1 2 3 No No No No Yes 2 3 1 No Yes 2 3 1 No No Yes 2 3 1 No No Yes 3 1 2 No No No No No No No Yes 3 2 1 No No Yes 3 2 1 No No No No No No No No No No No Yes 1 2 3 Yes 3 2 1 No No Yes 2 3 1 Yes 3 2 1 Yes 2 1 3 Yes 1 3 2 Yes 2 1 3 No ...
result:
wrong answer There is no valid answer, but participant found one. (test case 1)