QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#106105 | #6370. Slot Machine | Determinant | WA | 12ms | 15756kb | C++14 | 658b | 2023-05-16 16:14:30 | 2023-05-16 16:14:31 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;const int N=1e5+7;
int n,m,a[N],b[N],ans=1e9;vector<int>v[N];set<pair<int,int> >s[N];
int main(){
scanf("%d",&n);
for(int i=1;i<=n;++i){
scanf("%d",&m);for(int j=1;j<=m;++j){
scanf("%d",&a[j]);if(!b[a[j]])v[i].push_back(a[j]);b[a[j]]++;
}
for(int j=1;j<=m;++j)if(b[a[j]]){s[a[j]].insert({v[i].size(),i*(b[a[j]]==1)});b[a[j]]=0;}
}
for(int i=1;i<=n;++i){
m=0;for(auto j:v[i]){
a[++m]=1e9;for(auto k:s[j]){
if(k.second==i)continue;
a[m]=k.first+1;break;
}
}
sort(a+1,a+m+1,greater<int>());
for(int j=1;j<=m;++j)ans=min(ans,a[j]+j-1);
}
printf("%d\n",ans);
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 4ms
memory: 10576kb
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: 0
Accepted
time: 12ms
memory: 11128kb
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:
993
result:
ok 1 number(s): "993"
Test #3:
score: 0
Accepted
time: 5ms
memory: 11536kb
input:
10 1 3824 1 2925 1 7764 1 8966 1 8030 1 2016 1 4527 1 8663 1 9870 99991 1943 6028 31 1289 4759 4038 2644 3515 4874 2554 1346 6643 7036 9178 4359 999 3343 2269 6839 1086 9576 380 7384 2964 9439 1767 5255 1561 9587 5054 7794 2658 5780 7241 1148 3687 9607 2049 2109 2915 5734 6676 8319 3688 7149 9925 14...
output:
9993
result:
ok 1 number(s): "9993"
Test #4:
score: -100
Wrong Answer
time: 11ms
memory: 15756kb
input:
10 1 13787 1 2459 1 17625 1 37254 1 66685 1 89321 1 34439 1 52752 1 37870 99991 46244 2168 85404 39179 65139 97987 33018 88293 69552 25492 46256 75204 99178 95532 44501 22815 37156 18684 14103 81029 86292 40302 73270 25943 2469 89404 26503 69259 76629 87095 16369 70251 12024 80065 2899 95156 95827 1...
output:
184187
result:
wrong answer 1st numbers differ - expected: '94672', found: '184187'