QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#440412#8519. Radarsucup-team3586#WA 1ms3844kbC++231.1kb2024-06-13 18:03:512024-06-13 18:03:51

Judging History

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

  • [2024-06-13 18:03:51]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3844kb
  • [2024-06-13 18:03:51]
  • 提交

answer

//泥の分際で私だけの大切を奪おうだなん
#include<bits/stdc++.h>
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
using namespace std;
#define int long long
inline int read(){
   int s=0,w=1;
   char ch=getchar();
   while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
   while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
   return s*w;
}
const int p=998244353;
int qp(int x,int y)
{
	int res=1;
	for(int t=x; y; y>>=1,t=1ll*t*t%p)
		if(y&1) res=1ll*res*t%p;
	return res;
}
int a[1003][1003],f[16];
signed main()
{
	for(int T=read();T--;)
	{
		int n=read(),m=(n+1)/2;
		for(int i=1; i<=n; ++i)
			for(int j=1; j<=n; ++j)
				a[i][j]=read();
		for(int i=0; i<16; ++i) f[i]=1e18;
		for(int i=1; i<=n; ++i)
			for(int j=1; j<=n; ++j)
			{
				int S=0;
				if(i<=m) S+=1;
				if(i>=m) S+=2;
				if(j<=m) S+=4;
				if(j>=m) S+=8;
				f[S]=min(f[S],a[i][j]);
			}
		f[0]=0;
		for(int i=0; i<16; ++i)
			for(int j=i; j; j=i&(j-1))
				f[i]=min(f[i],f[j]+f[i-j]);
		printf("%lld\n",f[15]);
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3844kb

input:

2
3
1 1 1
1 1 1
1 1 1
5
8 5 2 8 3
5 6 9 7 3
7 8 9 1 4
8 9 4 5 5
2 8 6 9 3

output:

1
5

result:

ok 2 number(s): "1 5"

Test #2:

score: 0
Accepted
time: 1ms
memory: 3808kb

input:

1
1
444739567

output:

444739567

result:

ok 1 number(s): "444739567"

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3840kb

input:

32
5
177252602 814271963 432801178 401470194 888319541
320323627 34071000 116035631 87392694 926990496
423510770 515133425 777623990 140441392 853473387
976288681 925949889 930584554 939702106 761328886
840677679 912446055 378955738 997133668 334407172
3
633852912 89450314 828384045
327867173 732812...

output:

368478172
732812691
50799562
253343933
43083335
954430705
55567722
559671961
169811958
155243492
333898451
73118494
27100589
611970570
122741869
60323753
33730359
114032585
205453479
346576895
49710371
67974183
269414925
755829169
379523497
119908280
691515792
514331420
469380143
112988335
699595246...

result:

wrong answer 1st numbers differ - expected: '494991369', found: '368478172'