QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#441060#6370. Slot MachinemoyujiangWA 0ms16020kbC++141.2kb2024-06-14 11:43:482024-06-14 11:43:48

Judging History

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

  • [2024-06-14 11:43:48]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:16020kb
  • [2024-06-14 11:43:48]
  • 提交

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;
}

详细

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'