QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#774142#9786. Magical Bagsucup-team4474#WA 1ms3844kbC++201.2kb2024-11-23 12:03:012024-11-23 12:03:04

Judging History

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

  • [2024-11-23 12:03:04]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3844kb
  • [2024-11-23 12:03:01]
  • 提交

answer

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

bool Memory_begin;

bool Memory_end;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    cerr << (&Memory_end - &Memory_begin) / 1048576.0 << "MB" << '\n';

    int n;
    cin >> n;
    vector<pair<int, int>> a(n);
    for (int i = 0, x, y; i < n; i++)
    {
        cin >> x;
        a[i] = {1000000000, 1};
        while (x--)
        {
            cin >> y;
            a[i].first = min(a[i].first, y);
            a[i].second = max(a[i].second, y);
        }
    }
    int ans = n * 2;
    priority_queue<pair<int, int>> que;
    for (int i = 0; i < n; i++)
        que.push({a[i].second, i});
    while (!que.empty())
    {
        int mi = a[que.top().second].first, pre = mi;
        while (!que.empty() and que.top().first >= mi)
        {
            if (que.top().first < pre)
            {
                ans--;
                pre = que.top().first;
            }
            int id = que.top().second;
            que.pop();
            mi = min(mi, a[id].first);
        }
        ans--;
    }
    cout << ans << '\n';
}
/*

*/

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3844kb

input:

4
3 4 7 10
2 1 9
4 11 2 8 14
3 6 12 13

output:

7

result:

ok 1 number(s): "7"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3744kb

input:

4
1 1
1 2
1 3
1 4

output:

4

result:

ok 1 number(s): "4"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

4
3 4 7 10
2 1 9
4 11 2 8 14
3 6 12 13

output:

7

result:

ok 1 number(s): "7"

Test #4:

score: 0
Accepted
time: 0ms
memory: 3808kb

input:

4
1 1
1 2
1 3
1 4

output:

4

result:

ok 1 number(s): "4"

Test #5:

score: -100
Wrong Answer
time: 0ms
memory: 3812kb

input:

100
4 372861091 407948190 424244630 359746969
6 568180757 527358812 494745349 665803213 674832670 586694351
4 696340797 775899164 919971335 716827187
4 123145962 344250363 122030550 251739234
4 342654413 368648894 150539766 255189030
1 194505887
3 755984448 736803561 745474041
4 709314938 498953418 ...

output:

107

result:

wrong answer 1st numbers differ - expected: '177', found: '107'