QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#477071 | #2541. Coins and Boxes | LVJBot1 | TL | 0ms | 0kb | C++14 | 375b | 2024-07-13 23:06:15 | 2024-07-13 23:06:17 |
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