QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#106937 | #6370. Slot Machine | rgnerdplayer | WA | 10ms | 3516kb | C++20 | 1.6kb | 2023-05-19 20:39:08 | 2023-05-19 20:39:10 |
Judging History
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 (n == 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: 2ms
memory: 3360kb
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: 10ms
memory: 3516kb
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:
104 102 103 103 104 80 100 98 87 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 100...
result:
wrong answer 1st numbers differ - expected: '993', found: '104'