QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#860513#9975. Hitoshizukuucup-team3802#WA 241ms3584kbC++201.7kb2025-01-18 13:48:502025-01-18 13:49:00

Judging History

你现在查看的是最新测评结果

  • [2025-01-18 13:49:00]
  • 评测
  • 测评结果:WA
  • 用时:241ms
  • 内存:3584kb
  • [2025-01-18 13:48:50]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#define rep(i, l, r) for(ll i = l; i < r; i++)
#define all(ar) begin(ar), end(ar)

void solve() {
    int N;
    cin >> N;
    int n = N * 3;
    vector<pair<ll, ll>> ab;
    vector<ll> z;
    rep(i, 0, n) {
        ll a, b;
        cin >> a >> b;
        ab.emplace_back(a, b);
        z.push_back(a);
        z.push_back(b);
    }

    sort(all(z));
    z.erase(unique(all(z)), z.end());

    for(auto &[a, b] : ab) {
        a = lower_bound(all(z), a) - z.begin();
        b = lower_bound(all(z), b) - z.begin();
    }

    sort(all(ab));
    vector<vector<int>> ib(z.size());
    rep(i, 0, n) ib[ab[i].second].push_back(i);

    priority_queue<ll> pq;
    vector<bool> used(n);
    int nxt = n - 1;
    int mn = z.size();
    vector<tuple<int, int, int>> ans;
    rep(i, 0, N) {
        while(used[nxt]) nxt--;
        int a = ab[nxt].first;
        used[nxt] = true;
        rep(j, a, mn) {
            for(int idx : ib[j]) {
                if(!used[idx]) pq.push(idx);
            }
        }
        mn = a;
        vector<int> tmp;
        rep(j, 0, 2) {
            if(pq.empty()) {
                cout << "No" << endl;
                return;
            }
            int t = pq.top();
            pq.pop();
            if(used[t]) {
                j--;
                continue;
            }
            used[t] = true;
            tmp.push_back(t);
        }
        ans.emplace_back(nxt, tmp[0], tmp[1]);
    }

    cout << "Yes" << endl;
    for(auto [a, b, c] : ans) {
        cout << a + 1 << " " << b + 1 << " " << c + 1 << endl;
    }
}

int main() {
    int t;
    cin >> t;
    while(t--) {
        solve();
    }
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3584kb

input:

2
2
1 2
2 2
2 3
3 5
4 4
4 5
1
1 1
1 1000000000
1000000000 1000000000

output:

Yes
6 5 4
3 2 1
No

result:

ok >_< (2 test cases)

Test #2:

score: 0
Accepted
time: 241ms
memory: 3584kb

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
3 2 1
No
Yes
3 2 1
No
No
No
No
No
Yes
3 2 1
Yes
3 2 1
No
No
No
No
Yes
3 2 1
No
Yes
3 2 1
No
No
Yes
3 2 1
No
No
Yes
3 2 1
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
No
Yes
3 2 1
No
No
Yes
3 2 1
Yes
3 2 1
No
No
Yes
3 2 1
No
No
No
Yes
3 2 1
Yes
3 2 1
No...

result:

ok >_< (100000 test cases)

Test #3:

score: -100
Wrong Answer
time: 229ms
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
6 5 4
3 2 1
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
6 5 3
4 2 1
No
No
No
No
No
No
No
Yes
6 4 2
5 3 1
No
No
No
No
No
Yes
6 4 2
5 3 1
Yes
6 5 4
3 2 1
No
No
No
Yes
6 5 4
3 2 1
No
No
Yes
6 5 4
3 2 1
Yes
6 5 4
3 2 1
Yes
6 5 3
4 2 1
No
Yes
6 5 4
3 2 1
No...

result:

wrong answer Invalid team. (test case 30)