QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#629168 | #9437. Solve with Friends | huaxiamengjin | WA | 1ms | 5728kb | C++14 | 542b | 2024-10-11 07:49:33 | 2024-10-11 07:49:34 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int n,a[200100],b[200100];
int c[200100],d[200100];
long long ans;
int main(){
cin>>n;
for (int i=1;i<=n;i++)cin>>a[i],ans+=a[i];
for (int i=1;i<=n;i++)cin>>b[i],b[i]=a[i]-b[i];
for (int i=0;i<n;i++)cin>>c[i],ans+=c[i];
for (int i=0;i<n;i++)cin>>d[i];
sort(b+1,b+n+1);
for (int i=n-1;~i;i--){
int tmp=c[i]-d[n-i-1]+b[i+1];
// cout<<i<<" "<<"***"<<tmp<<"\n";
if(tmp>=0)ans-=tmp;
else break;
}
cout<<ans<<'\n';
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3700kb
input:
3 1 3 5 6 4 2 1 2 3 1 2 3
output:
10
result:
ok "10"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
5 2 4 3 1 2 9 2 5 3 8 1 2 8 3 2 5 4 3 2 1
output:
28
result:
ok "28"
Test #3:
score: 0
Accepted
time: 1ms
memory: 5728kb
input:
8 21 85 72 22 81 20 88 28 75 22 78 92 55 56 73 44 39 14 64 27 73 42 16 84 27 7 91 85 69 95 70 27
output:
621
result:
ok "621"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
11 141 130 761 372 345 44 748 993 177 653 57 193 204 209 98 848 495 120 505 288 454 73 209 689 533 543 201 437 362 861 541 308 673 320 126 38 405 551 627 577 591 195 305 432
output:
6332
result:
ok "6332"
Test #5:
score: -100
Wrong Answer
time: 1ms
memory: 5696kb
input:
40 363 411 688 848 677 296 110 36 879 755 88 877 812 668 660 656 680 577 124 719 302 627 832 721 846 79 992 834 356 826 261 846 342 896 291 385 18 412 272 694 911 939 402 895 617 616 934 492 475 304 697 769 39 918 206 638 487 50 959 537 569 830 889 829 22 104 744 945 399 641 376 72 810 177 298 44 27...
output:
36512
result:
wrong answer 1st words differ - expected: '35024', found: '36512'