QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#106936#6370. Slot MachinergnerdplayerWA 13ms3692kbC++201.6kb2023-05-19 20:38:342023-05-19 20:38:35

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-19 20:38:35]
  • 评测
  • 测评结果:WA
  • 用时:13ms
  • 内存:3692kb
  • [2023-05-19 20:38:34]
  • 提交

answer

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

using i64 = long long;

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);

#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    auto solve = [&]() {
        constexpr int INF = 1e9;
        int ans = INF;

        int n;
        cin >> n;

        vector<map<int, int>> boxes(n);
        map<int, set<pair<int, int>>> other;

        for (int i = 0; i < n; i++) {
            int c;
            cin >> c;
            for (int j = 0; j < c; j++) {
                int x;
                cin >> x;
                boxes[i][x]++;
            }
            for (auto [x, y] : boxes[i]) {
                if (y > 1) {
                    ans = min(ans, int(boxes[i].size()) + 1);
                }
                other[x].emplace(y, i);
            }
        }

        for (int i = 0; i < n; i++) {
            vector<int> v;
            for (auto [x, y] : boxes[i]) {
                int need = INF;
                for (auto [c, j] : other[x]) {
                    if (i == j) {
                        continue;
                    }
                    need = c;
                    break;
                }
                v.push_back(need);
            }
            sort(v.rbegin(),v.rend());
            for (int j = 0; j < int(v.size()); j++) {
                if (j == 10) {
                    cout << v[j] << " \n"[j + 1 == int(v.size())];
                }
                ans = min(ans, v[j] + j + 1);
            }
        }

        cout << ans << '\n';
    };
    
    solve();
    
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

7
4 1 2 3 4
1 1
1 2
1 3
1 4
7 4 7 4 4 7 7 4
1 5

output:

2

result:

ok 1 number(s): "2"

Test #2:

score: -100
Wrong Answer
time: 13ms
memory: 3692kb

input:

10
1 971
1 472
1 799
1 68
1 729
1 592
1 616
1 148
1 188
99991 18 79 923 610 734 650 745 482 627 651 914 251 785 787 949 204 400 2 365 569 623 536 508 341 398 840 371 450 332 223 36 578 850 857 192 474 309 933 457 162 200 140 802 462 40 957 553 640 302 748 532 323 593 239 657 425 17 584 924 903 413 3...

output:

1000000000 81

result:

wrong answer 1st numbers differ - expected: '993', found: '1000000000'