QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#553866#8332. Two in OneHog_Dawa_IOIWA 0ms1628kbC++14588b2024-09-08 21:37:522024-09-08 21:37:53

Judging History

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

  • [2024-09-08 21:37:53]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:1628kb
  • [2024-09-08 21:37:52]
  • 提交

answer

#include<stdio.h>
int t,n,s,ci[100005];
int main()
{
    scanf("%d",&t);
    while(t--)
    {
        for(int i=1;i<=n;i++) ci[i]=0;
        scanf("%d",&n);
        for(int i=1;i<=n;i++) scanf("%d",&s),ci[s]++;
        int k1=0,k2=0;
        for(int i=1;i<=n;i++) if(ci[i]>=ci[k1]) k1=i;
        for(int i=1;i<=n;i++) if(ci[i]>=ci[k2]&&i!=k1) k2=i;
        int ans=ci[k1]|ci[k2],dq=ci[k1]&ci[k2],mi=1,nono=1;
        while(mi<=dq)
        {
            if(mi&dq) nono=mi;
            mi*=2;
        }
        printf("%d\n%d %d\n%d %d\n",ans|(nono-1),1,1,1,1);
    }
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 1628kb

input:

1
7
1 2 3 4 3 2 1

output:

3
1 1
1 1

result:

wrong answer Output contains longer sequence [length = 5], but answer contains 1 elements