QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#477076#2541. Coins and BoxesLVJBot1TL 0ms0kbC++14374b2024-07-13 23:07:592024-07-13 23:08:00

Judging History

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

  • [2024-07-13 23:08:00]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2024-07-13 23:07:59]
  • 提交

answer

/* Submission UUID: 8229. */
#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;}

详细

Test #1:

score: 0
Time Limit Exceeded

input:

4
1 6 7 12
3 5 10 11

output:


result: