QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#439372#6370. Slot MachinemoyujiangWA 10ms8844kbC++14881b2024-06-11 20:39:392024-06-11 20:39:40

Judging History

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

  • [2024-06-11 20:39:40]
  • 评测
  • 测评结果:WA
  • 用时:10ms
  • 内存:8844kb
  • [2024-06-11 20:39:39]
  • 提交

answer

#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a),i##END=(b);i<=i##END;i++)
#define Rof(i,b,a) for(int i=(b),i##END=(a);i>=i##END;i--)
#define go(u) for(int i=head[u];i;i=nxt[i])
using namespace std;
inline int read(){
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}
    return x*f;
}
const int N=1e5+10;
int n,L[N],ans,mn[N];
map<int,int> a[N];
signed main(){
	n=read(),ans=1e9,memset(mn,0x3f,sizeof mn);
	For(i,1,n){
		int sz=read();
		For(j,1,sz)a[i][read()]++;
		for(auto [x,y]:a[i]){
			if(y>1)ans=min(ans,sz+1);
			mn[x]=min(mn[x],sz);
		}
	}For(i,1,n){
		vector<int> t;
		for(auto [x,y]:a[i])
			t.push_back(mn[x]);
		sort(t.begin(),t.end());
		For(i,1,t.size())ans=min(ans,i+t[i-1]);
	}printf("%d\n",ans);
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 8780kb

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: 8844kb

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:

2

result:

wrong answer 1st numbers differ - expected: '993', found: '2'