QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#674408 | #5754. Minimum Scalar Product | Hog_Dawa_IOI | 0 | 1ms | 1608kb | C++14 | 384b | 2024-10-25 15:36:18 | 2024-10-25 15:36:19 |
answer
#include<cstdio>
#include<algorithm>
using namespace std;
int t,n;long long a[200005],b[200005],sum;
int main()
{
scanf("%d",&t);
while(t--)
{
scanf("%d",&n),sum=0;
for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
for(int i=1;i<=n;i++) scanf("%lld",&b[i]);
sort(a+1,a+n+1),sort(b+1,b+n+1);
for(int i=1;i<=n;i++) sum+=a[i]*b[n-i+1];
printf("%lld\n",sum);
}
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 1608kb
input:
1000 3 -5 3 1 1 4 -2 5 3 1 5 2 4 0 1 1 0 1 8 372 887 -30 -600 -63 -947 526 307 -430 -426 -168 -538 350 515 988 299 7 891 -7 -475 163 495 -52 305 -381 248 -2 458 -114 -44 -47 1 -399 -394 8 49 31 -847 -310 348 -746 244 -907 11 -952 -772 741 -655 770 283 393 4 850 251 209 -896 237 669 884 -733 3 604 -8...
output:
-25 6 -2189090 -647840 157206 -2258343 -1215806 -678102 -2052381 -3313 -1012446 -2501563 -2486781 -2337367 -331927 -3202403 -2351174 -1280099 -2558825 1497696 328015 -3060132 -297596 -3978981 -3113675 -2999545 -570223 -926634 -2065882 -409158 -617738 -166630 226500 -363306 -3139303 -1560908 -1136952...
result:
wrong answer 1st lines differ - expected: 'Case #1: -25', found: '-25'
Subtask #2:
score: 0
Wrong Answer
Test #2:
score: 0
Wrong Answer
time: 1ms
memory: 1556kb
input:
10 800 -99991 99994 99990 -99996 -99997 -99995 -99992 99996 -99994 -99998 99995 -99995 99998 99990 99995 -99994 -100000 -99993 -99992 -99994 99993 99997 -99998 99998 99995 99999 99999 -99994 -99994 99996 99996 -99995 -99990 99996 100000 -99997 99991 99998 99991 99995 -99995 -99991 99992 -100000 -999...
output:
-7679252425391 7999194112308 -2403218837859 -1667618153839 -3549092346279 -1565711442951 -3107964725218 -3683981926681 -485263372448 -2737947356587
result:
wrong answer 1st lines differ - expected: 'Case #1: -7679252425391', found: '-7679252425391'