QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#441060 | #6370. Slot Machine | moyujiang | WA | 0ms | 16020kb | C++14 | 1.2kb | 2024-06-14 11:43:48 | 2024-06-14 11:43:48 |
Judging History
answer
#include<iostream>
#include<map>
#include<cstring>
#include<vector>
#include<set>
using namespace std;
const int N=100010;
map<int,int> mp[N],times[N];
int minn[N],minnn[N];
int n;
int l[N];
vector<int> g[N];
int main()
{
memset(minn,0x3f,sizeof(minn));
memset(minnn,0x3f,sizeof(minnn));
cin>>n;
int ans=1e9;
for(int i=1;i<=n;i++)
{
cin>>l[i];
set<int> s;
for(int j=1;j<=l[i];j++)
{
int x;
cin>>x;
s.insert(x);
g[i].push_back(x);
}
int now=s.size();
for(int it:g[i])
{
mp[i][it]=now;
if(now<minn[it])
{
minnn[it]=minn[it];
minn[it]=now;
}
else if(now<minnn[it])
minnn[it]=now;
times[i][it]++;
}
}
for(int i=1;i<=n;i++)
{
for(int it:g[i])
{
if(mp[i][it]==minn[it])
ans=min(ans,mp[i][it]+minnn[it]);
else
ans=min(ans,mp[i][it]+minn[it]);
if(times[i][it]>1)
ans=min(ans,mp[i][it]+1);
}
}
cout<<ans;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 16020kb
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:
3
result:
wrong answer 1st numbers differ - expected: '2', found: '3'