Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
51564 野兽先辈——田所浩二 最优子序列 C++ 解答错误 0 1000 MS 12092 KB 1056 2022-07-13 11:52:54

Tests(0/20):


#include<cstdio> #include<iostream> #include<algorithm> #define ll long long using namespace std; const int N=1005; int n,k,cnt,f[N<<1]; ll ans; struct node { int x,y,z; } edge[N*N]; bool cmp(node a,node b) { return a.z>b.z; } int find(int x) { if(f[x]!=x) f[x]=find(f[x]); return f[x]; } int main() { int x,y,z,fx,fy,sum; scanf("%d%d",&n,&k); for(int i=1; i<=n; i++) for(int j=1; j<=n; j++) { scanf("%d",&x); if(i>=j) continue; edge[++cnt]=(node) { i,j,x }; edge[++cnt]=(node) { i,j+n,k-x }; } if(k==1) { printf("%d",(n-2)*(n-1)/2); return 0; } sort(edge+1,edge+1+cnt,cmp); for(int i=1; i<=2*n; i++) f[i]=i; for(int i=1; i<=cnt; i++) { x=edge[i].x; y=edge[i].y; z=edge[i].z; fx=find(x); fy=find(y); if(fx==fy) ans+=z; else { if(sum==n) continue; sum++; ans+=z; f[fy]=fx; } } printf("%d\n",ans); return 0; }


测评信息:

输入

20 12 0
jhlbfajhlbfajhlbfaag

输出

2280

答案

10

检查日志

wrong answer The length is wrong: expected = 10, found = 2280

系统信息

exit code: 0, checker exit code: 1

输入

20 12 0
ehjbehjbehjbkhlckhlc

输出

2280

答案

10

检查日志

wrong answer The length is wrong: expected = 10, found = 2280

系统信息

exit code: 0, checker exit code: 1

输入

200 4 0
abababababababababababababababababababababababababababababdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdaadcbcbcbcbcbcbc...

输出

79600

答案

101

检查日志

wrong answer The length is wrong: expected = 101, found = 79600

系统信息

exit code: 0, checker exit code: 1

输入

200 4 0
dbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbdbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcccccccccccccccccccccccccccccccccccccccccccccccccdcdcdcbb...

输出

79600

答案

128

检查日志

wrong answer The length is wrong: expected = 128, found = 79600

系统信息

exit code: 0, checker exit code: 1

输入

200 12 0
idljidljidljidljidljidljidljidljidljidljidljidljidljidljidljidljidljidljidljidljidljidljidljidljidljidljidljidljidljidljidljidljidljidljidljidljelhdelhdelhdelhdelhdelhdelhdelhdkdliehfichficl...

输出

238800

答案

57

检查日志

wrong answer The length is wrong: expected = 57, found = 238800

系统信息

exit code: 0, checker exit code: 1

输入

200 12 0
gbalfgbalfgbalfgbalfgbalfgbalfgbalfgbalfgbalfgbalfgbalfgbalfgbalfgbalfgbalfgbalfgbalfgbalfgbalfgbalfgbalfgbalfaebgaebgjahldijahldijahldijahldijahldijahldijahldijahldijahldijahldijahldicgkhea...

输出

238800

答案

47

检查日志

wrong answer The length is wrong: expected = 47, found = 238800

系统信息

exit code: 0, checker exit code: 1

输入

200 12 1
cgiahcgiahcgiahcgiahcgiahcgiahcgiahcgiahcgiahcgiahcgiahcgiahcgiahcgiahcgiahcgiahcgiahcfacfacfacfacfacfacfalkcglkcglkcglkcglkcglkcglkcglkcglkcglkcglkcglkcglkcglkcglkcglkcglkcglkcglgfalgfaifbi...

输出

238800

答案

54
aaaaaaaaaaaaaaaaaaaaaaaalkccccccccccccccccccggfffbbbbi

检查日志

wrong answer The length is wrong: expected = 54, found = 238800

系统信息

exit code: 0, checker exit code: 1

输入

200 12 1
gacbegacbegacbegacbegacbegacbegacbegacbegacbegacbegacbegacbegacbegacbegacbegacbegacbegacbegacbegacbekfjkfjkfjkfjkfjkfjkfjkfjkfjkfjkfjcekgdcekgdcekgdcekgdcekgdcekgdcekgdcekgdcekgdiefajiefajie...

输出

238800

答案

51
aaaaaaaaaaaaaaaaaaaabekkkkkkkkkkkkdddddddddfffjjicg

检查日志

wrong answer The length is wrong: expected = 51, found = 238800

系统信息

exit code: 0, checker exit code: 1

输入

200 12 2
jaeiljaeiljaeiljaeiljaeiljaeiljaeiljaeiljaeiljaeiljaeiljaeiljaeiljaeiljaeiljaeiljaeiljaeiljaeiljaeiljaeiljaeiljaeiljaeiljaeiljaeiljaeiljaeiljaeiljaeiljaeiljaeiljaeiljaeiljaeilhalkhalkhalkcjg...

输出

238800

答案

48
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaeihhhcjfkbdgl

检查日志

wrong answer The length is wrong: expected = 48, found = 238800

系统信息

exit code: 0, checker exit code: 1

输入

200 12 2
jhgajhgajhgajhgajhgajhgajhgajhgajhgajhgajhgajhgajhgajhgajhgajhgajhgajhgajhgajhgajhgajhgajhgajhgajhgajhgajhgajhgajhgajhgajhgajhgajhgacjlfedcjlfedcjlfedcjlfedcjlfedcjlfedcjlfedcjlfedcjlfedcjlf...

输出

238800

答案

51
hgaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacccccccccccjlfed

检查日志

wrong answer The length is wrong: expected = 51, found = 238800

系统信息

exit code: 0, checker exit code: 1

输入

3000 12 0
fejbhfejbhfejbhfejbhfejbhfejbhfejbhfejbhfejbhfejbhfejbhfejbhfejbhfejbhfejbhfejbhfejbhfejbhfejbhfejbhfejbhfejbhfejbhfejbhfejbhfejbhfejbhfejbhfejbhfejbhfejbhfejbhfejbhfejbhfejbhfejbhfejbhfejb...

输出

                    

答案

607

检查日志

wrong answer The length is wrong: expected = 51, found = 238800

系统信息

exit code: 0, checker exit code: 0

输入

3000 12 0
dhefjdhefjdhefjdhefjdhefjdhefjdhefjdhefjdhefjdhefjdhefjdhefjdhefjdhefjdhefjdhefjdhefjdhefjdhefjdhefjdhefjdhefjdhefjdhefjdhefjdhefjdhefjdhefjdhefjdhefjdhefjdhefjdhefjdhefjdhefjdhefjdhefjdhef...

输出

                    

答案

661

检查日志

wrong answer The length is wrong: expected = 51, found = 238800

系统信息

exit code: 0, checker exit code: 0

输入

3000 12 1
eihdjeihdjeihdjeihdjeihdjeihdjeihdjeihdjeihdjeihdjeihdjeihdjeihdjeihdjeihdjeihdjeihdjeihdjeihdjeihdjeihdjeihdjeihdjeihdjeihdjeihdjeihdjeihdjeihdjeihdjeihdjeihdjeihdjeihdjeihdjeihdjeihdjeihd...

输出

                    

答案

837
hddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddiiiiiiiiiiiiiiiiiiiiiiiiiiii...

检查日志

wrong answer The length is wrong: expected = 51, found = 238800

系统信息

exit code: 0, checker exit code: 0

输入

3000 12 1
ekjdlekjdlekjdlekjdlekjdlekjdlekjdlekjdlekjdlekjdlekjdlekjdlekjdlekjdlekjdlekjdlekjdlekjdlekjdlekjdlekjdlekjdlekjdlekjdlekjdlekjdlekjdlekjdlekjdlekjdlekjdlekjdlekjdlekjdlekjdlekjdlekjdlekjd...

输出

                    

答案

607
ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd...

检查日志

wrong answer The length is wrong: expected = 51, found = 238800

系统信息

exit code: 0, checker exit code: 0

输入

3000 12 2
jbhflkjbhflkjbhflkjbhflkjbhflkjbhflkjbhflkjbhflkjbhflkjbhflkjbhflkjbhflkjbhflkjbhflkjbhflkjbhflkjbhflkjbhflkjbhflkjbhflkjbhflkjbhflkjbhflkjbhflkjbhflkjbhflkjbhflkjbhflkjbhflkjbhflkjbhflkjbh...

输出

                    

答案

585
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbhfkaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

检查日志

wrong answer The length is wrong: expected = 51, found = 238800

系统信息

exit code: 0, checker exit code: 0

输入

3000 12 2
gbjaekgbjaekgbjaekgbjaekgbjaekgbjaekgbjaekgbjaekgbjaekgbjaekgbjaekgbjaekgbjaekgbjaekgbjaekgbjaekgbjaekgbjaekgbjaekgbjaekgbjaekgbjaekgbjaekgbjaekgbjaekgbjaekgbjaekgbjaekgbjaekgbjaekgbjaekgbj...

输出

                    

答案

517
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

检查日志

wrong answer The length is wrong: expected = 51, found = 238800

系统信息

exit code: 0, checker exit code: 0

输入

3000 12 2
fjladfjladfjladfjladfjladfjladfjladfjladfjladfjladfjladfjladfjladfjladfjladfjladfjladfjladfjladfjladfjladfjladfjladfjladfjladfjladfjladfjladfjladfjladfjladfjladfjladfjladfjladfjladfjladfjla...

输出

                    

答案

629
fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff...

检查日志

wrong answer The length is wrong: expected = 51, found = 238800

系统信息

exit code: 0, checker exit code: 0

输入

3000 12 2
fdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihfdihf...

输出

                    

答案

758
ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd...

检查日志

wrong answer The length is wrong: expected = 51, found = 238800

系统信息

exit code: 0, checker exit code: 0

输入

3000 12 2
dhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgjbdhgj...

输出

                    

答案

615
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

检查日志

wrong answer The length is wrong: expected = 51, found = 238800

系统信息

exit code: 0, checker exit code: 0

输入

3000 12 2
jlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbdgjlbd...

输出

                    

答案

583
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

检查日志

wrong answer The length is wrong: expected = 51, found = 238800

系统信息

exit code: 0, checker exit code: 0