ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#207003 | #3728. 线性回归 | wyz_ | 100 | 0ms | 1296kb | C++11 | 636b | 2024-07-26 18:49:18 | 2024-07-26 21:47:49 |
answer
#include<bits/stdc++.h>
using namespace std;
long long n,k1,k2,a[1005];
priority_queue<long long>pq;
int main(){
ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
cin >> n >> k1 >> k2;
k1 += k2;
for(int i = 1; i <= n; i++)
cin >> a[i];
for(int i = 1; i <= n; i++){
int tmp;
cin >> tmp;
pq.push(abs(a[i] - tmp));
}
while(pq.size() && k1 > 0){
int tmp = pq.top();
pq.pop();
k1--;
tmp--;
if(tmp)
pq.push(tmp);
}
if(k1 > 0)
cout << (k1 & 1);
else{
long long sum = 0;
while(pq.size())
sum += pow(pq.top(),2), pq.pop();
cout << sum;
}
return 0;
}
Details
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 1268kb
input:
10 6 2 454418 -21426 23410 -443720 225317 -685090 80034 -728695 -384192 416885 -941014 437793 -21070...
output:
5158776212426
result:
ok 1 number(s): "5158776212426"
Test #2:
score: 10
Accepted
time: 0ms
memory: 1272kb
input:
7 5 3 -726055 789663 546332 -572937 -114642 -24729 -65539 910769 719028 -762815 971833 -51397 -76057...
output:
7340826837620
result:
ok 1 number(s): "7340826837620"
Test #3:
score: 10
Accepted
time: 0ms
memory: 1272kb
input:
145 0 1 714745 473118 -360070 -879359 -565865 -173780 -906712 715547 259048 40922 -956534 886945 766...
output:
97736494687094
result:
ok 1 number(s): "97736494687094"
Test #4:
score: 10
Accepted
time: 0ms
memory: 1268kb
input:
107 1 1 -946535 -89553 156363 113243 -185508 -570695 230514 564782 950532 353178 -462581 753586 -871...
output:
77662625409028
result:
ok 1 number(s): "77662625409028"
Test #5:
score: 10
Accepted
time: 0ms
memory: 1272kb
input:
171 125 74 366955 -483111 -214043 883670 -873452 537606 -892146 185468 -521414 986822 -402553 -12202...
output:
101824656703435
result:
ok 1 number(s): "101824656703435"
Test #6:
score: 10
Accepted
time: 0ms
memory: 1268kb
input:
102 130 32 -464430 -307476 -253513 -605233 330089 906266 749185 -663800 570293 -538072 443285 -41426...
output:
74022150616924
result:
ok 1 number(s): "74022150616924"
Test #7:
score: 10
Accepted
time: 0ms
memory: 1292kb
input:
880 925 26 -400382 -56034 559256 -36567 -246370 990342 -986983 -941884 932594 -123561 -484678 -90634...
output:
552289715840346
result:
ok 1 number(s): "552289715840346"
Test #8:
score: 10
Accepted
time: 0ms
memory: 1296kb
input:
953 822 20 -420214 344903 -285687 -480800 921852 -24628 100883 -318341 849126 -554604 -476435 580574...
output:
598734857665984
result:
ok 1 number(s): "598734857665984"
Test #9:
score: 10
Accepted
time: 0ms
memory: 1296kb
input:
621 636 288 636387 -78786 410613 -27662 -656072 113546 -135323 -842935 -370862 383957 278465 -45638 ...
output:
433452844975546
result:
ok 1 number(s): "433452844975546"
Test #10:
score: 10
Accepted
time: 0ms
memory: 1296kb
input:
800 616 256 20476 987852 -955837 159323 -250711 -762835 260050 499413 -40854 471982 809493 463149 16...
output:
552952018857639
result:
ok 1 number(s): "552952018857639"