QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#477071#2541. Coins and BoxesLVJBot1TL 0ms0kbC++14375b2024-07-13 23:06:152024-07-13 23:06:17

Judging History

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

  • [2024-07-13 23:06:17]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2024-07-13 23:06:15]
  • 提交

answer

/* Submission UUID: 8228. */
#include<bits/stdc++.h>
using namespace std;int a[1010],b[1010],n,i=1,h,y=0;int main(){;cin>>n;for(;i<=n;i++) cin>>a[i];for(;i<=n*2;i++) cin>>b[i];sort(a,a+i/2);sort(b,b+i/2);for(int x=1,z=1;x+z<=i;){if(a[x]+a[z+1]>a[x]+b[z]&&i/2-z>=1&&i/2-x>=1) h+=a[x]+b[z],x++,z++;else if(i/2-x!=0) h+=a[x],y++;else if(i/2-z!=0) h+=b[x],y--;}cout<<h;return 0;}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Time Limit Exceeded

input:

4
1 6 7 12
3 5 10 11

output:


result: