QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#729565 | #2455. Retribution! | DJ_F | AC ✓ | 303ms | 51484kb | C++17 | 1.6kb | 2024-11-09 17:22:49 | 2024-11-09 17:22:50 |
Judging History
answer
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<iomanip>
#define int long long
using namespace std;
const int N = 1e3+5;
int t=1, n, m, p;
int a[N], mp[N][N];
double ans=0;
struct note {
double x, y;
}jud[N], fea[N];
struct edge {
int a, b;
double l;
};
bool cmp (edge x, edge y) {
if(x.l==y.l) {
if(x.a==y.a) {
return x.b < y.b;
}
return x.a < y.a;
}
return x.l < y.l;
}
bool vis[N], vis1[N];
void work(int x)
{
vector<edge> vec;
int cnt=0;
for(int i=1; i<=x; i++)
{
vis[i]=0;
vis1[i]=0;
cin>>fea[i].x>>fea[i].y;
}
for(int i=1; i<=n; i++)
{
for(int j=1; j<=x; j++)
{
double dis = sqrt((jud[i].x-fea[j].x)*(jud[i].x-fea[j].x)+(jud[i].y-fea[j].y)*(jud[i].y-fea[j].y));
vec.push_back({i, j, dis});
}
}
sort(vec.begin(), vec.end(), cmp);
for(edge i: vec)
{
// cout<<i.a<<' '<<i.b<<' '<<i.l<<'\n';
if(cnt==n) break;
if(vis[i.a]==0 && vis1[i.b]==0)
{
cnt++;
ans += i.l;
vis[i.a]=1;
vis1[i.b]=1;
}
}
}
void solve()
{
cin>>n>>m>>p;
for(int i=1; i<=n; i++)
{
cin>>jud[i].x>>jud[i].y;
}
work(m);
work(p);
cout<<fixed<<setprecision(6)<<ans;
}
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
// cin>>t;
while(t--) {
solve();
}
}
/*
for(int i=1; i<=n; i++)
3 3 3
1 0
2 0
1 3
0 0
3 0
2 2
1 1
2 1
3 2
7.650282
*/
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3988kb
input:
2 2 2 1 0 2 0 0 0 3 0 1 1 2 1
output:
4.000000
result:
ok found '4.0000000', expected '4.0000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3940kb
input:
1 1 1 5875 3435 -743 8951 2325 7352
output:
13901.685460
result:
ok found '13901.6854600', expected '13901.6854603', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
2 2 2 0 0 10 0 6 0 20 0 6 0 20 0
output:
48.000000
result:
ok found '48.0000000', expected '48.0000000', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3944kb
input:
4 4 4 0 0 10 0 15 -15 1 40 5 0 0 -5 -5 0 0 5 5 0 0 -5 0 5 -5 0
output:
157.822459
result:
ok found '157.8224590', expected '157.8224594', error '0.0000000'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3976kb
input:
4 4 4 0 0 10 0 15 -15 1 40 5 0 -5 0 0 -5 0 5 5 0 -5 0 0 5 0 -5
output:
150.850216
result:
ok found '150.8502160', expected '150.8502158', error '0.0000000'
Test #6:
score: 0
Accepted
time: 0ms
memory: 4036kb
input:
4 4 4 0 0 10 0 15 -15 1 40 5 0 0 5 0 -5 -5 0 5 0 0 5 -5 0 0 -5
output:
149.311186
result:
ok found '149.3111860', expected '149.3111862', error '0.0000000'
Test #7:
score: 0
Accepted
time: 0ms
memory: 4044kb
input:
4 4 4 0 0 10 0 15 -15 1 40 0 -5 5 0 -5 0 0 5 0 -5 5 0 0 5 -5 0
output:
145.461780
result:
ok found '145.4617800', expected '145.4617796', error '0.0000000'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3976kb
input:
4 4 4 0 0 10 0 15 -15 1 40 0 -5 -5 0 5 0 0 5 0 -5 -5 0 0 5 5 0
output:
140.028566
result:
ok found '140.0285660', expected '140.0285656', error '0.0000000'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3944kb
input:
4 4 4 0 0 10 0 15 -15 1 40 0 -5 0 5 5 0 -5 0 0 -5 0 5 -5 0 5 0
output:
150.894994
result:
ok found '150.8949940', expected '150.8949937', error '0.0000000'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
4 4 4 0 0 10 0 15 -15 1 40 -5 0 5 0 0 -5 0 5 -5 0 5 0 0 5 0 -5
output:
126.084078
result:
ok found '126.0840780', expected '126.0840784', error '0.0000000'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
4 4 4 0 0 10 0 15 -15 1 40 -5 0 0 -5 5 0 0 5 -5 0 0 -5 0 5 5 0
output:
126.084078
result:
ok found '126.0840780', expected '126.0840784', error '0.0000000'
Test #12:
score: 0
Accepted
time: 0ms
memory: 4036kb
input:
4 4 4 0 0 10 0 15 -15 1 40 -5 0 0 5 5 0 0 -5 -5 0 0 5 0 -5 5 0
output:
126.084078
result:
ok found '126.0840780', expected '126.0840784', error '0.0000000'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3880kb
input:
4 4 4 0 0 10 0 15 -15 1 40 0 5 5 0 0 -5 -5 0 0 5 5 0 -5 0 0 -5
output:
136.950506
result:
ok found '136.9505060', expected '136.9505064', error '0.0000000'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3764kb
input:
4 4 4 0 0 10 0 15 -15 1 40 0 5 0 -5 5 0 -5 0 0 5 0 -5 -5 0 5 0
output:
136.950506
result:
ok found '136.9505060', expected '136.9505064', error '0.0000000'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
4 4 4 0 0 10 0 15 -15 1 40 0 5 -5 0 5 0 0 -5 0 5 -5 0 0 -5 5 0
output:
136.950506
result:
ok found '136.9505060', expected '136.9505064', error '0.0000000'
Test #16:
score: 0
Accepted
time: 0ms
memory: 4036kb
input:
5 5 5 0 0 10 10 20 20 30 30 40 40 10 0 20 10 30 20 40 30 50 40 0 10 10 20 20 30 30 40 40 50
output:
100.000000
result:
ok found '100.0000000', expected '100.0000000', error '0.0000000'
Test #17:
score: 0
Accepted
time: 25ms
memory: 8780kb
input:
200 500 500 9317 9422 967 -1586 4914 -1686 298 -2757 5733 7839 2366 -1911 -6760 -7344 -5277 -8055 -6719 1100 6048 9021 -2631 -1185 -9021 -2756 -871 -8829 5937 630 -4120 501 -2119 -4639 -3429 9773 -8790 -5080 -4588 -4404 -983 -4692 -2901 -7622 5147 1450 -6601 4971 5450 758 -4282 -8352 -3228 3634 -850...
output:
0.000000
result:
ok found '0.0000000', expected '0.0000000', error '-0.0000000'
Test #18:
score: 0
Accepted
time: 8ms
memory: 5764kb
input:
100 300 500 9474 1058 9474 1058 9474 1058 9474 1058 9474 1058 9474 1058 9474 1058 9474 1058 9474 1058 9474 1058 9474 1058 9474 1058 9474 1058 9474 1058 9474 1058 9474 1058 9474 1058 9474 1058 9474 1058 9474 1058 9474 1058 9474 1058 9474 1058 9474 1058 9474 1058 9474 1058 9474 1058 9474 1058 9474 105...
output:
1320642.635789
result:
ok found '1320642.6357890', expected '1320642.6357891', error '0.0000000'
Test #19:
score: 0
Accepted
time: 170ms
memory: 42744kb
input:
600 1000 1000 -5279 9183 -5142 2199 1159 8000 6190 3760 -2235 -3115 -3717 -4337 2385 -9717 1979 2349 -670 -4911 -5219 -3475 6690 852 4558 -2037 -3487 -9769 488 -2979 -3320 -615 -6510 -6853 3865 -4778 3686 -2060 -8277 9430 5648 7885 -967 -1666 -4585 9127 2337 -5555 -2880 -3590 3781 36 -9745 3021 6773...
output:
470049.330284
result:
ok found '470049.3302840', expected '470049.3302835', error '0.0000000'
Test #20:
score: 0
Accepted
time: 24ms
memory: 9452kb
input:
100 1000 1000 922 9101 3100 1580 1294 -7721 -6165 -8516 394 -2688 -4818 -639 -5290 -6133 -5489 -8166 -2548 -7234 -3512 -3708 -7119 -2390 -6967 3042 -5045 -1628 -5421 8596 -1425 -8296 9360 -3574 -3753 -5373 4029 673 -2627 -9196 9349 -8286 1699 6300 -844 -2833 7124 -5145 -7703 8708 -3414 -5303 1485 -6...
output:
69604.347811
result:
ok found '69604.3478110', expected '69604.3478113', error '0.0000000'
Test #21:
score: 0
Accepted
time: 45ms
memory: 15748kb
input:
200 1000 1000 -1619 9114 1049 7500 -3000 769 2127 3934 -4197 -2177 -4642 -1231 -4641 -3114 -1673 -4935 -7150 1734 -7717 -9152 9270 -9497 1090 -2435 -6345 -8752 -5055 -4473 -5422 -1092 -4397 -4337 819 -2418 -1269 6057 -671 -973 -7312 -9971 -8873 2983 -3826 9566 8980 -8070 -2999 425 1329 -8142 -5555 -...
output:
129789.144361
result:
ok found '129789.1443610', expected '129789.1443608', error '0.0000000'
Test #22:
score: 0
Accepted
time: 78ms
memory: 24380kb
input:
300 1000 1000 -646 9131 -9706 -1483 3867 6807 257 -504 -2170 -5156 -4422 -1970 -212 -3491 6715 -5045 -561 -8015 -8399 1 1138 2045 -9372 7103 -3820 -1273 -979 3765 -1801 3338 2983 -9333 -1657 1701 -7891 -3596 2199 9306 -7712 157 -9746 -1164 -7127 -7702 -5085 615 -8928 2306 3108 -3074 5646 -8760 -6340...
output:
209890.445880
result:
ok found '209890.4458800', expected '209890.4458797', error '0.0000000'
Test #23:
score: 0
Accepted
time: 106ms
memory: 25536kb
input:
400 1000 1000 -3710 9154 -5103 -7506 -1414 -6528 -233 8516 329 -646 -4113 -3006 -2693 408 -2990 -773 -2657 -4130 -7566 -7185 -1567 -3583 6962 -6098 -4712 2644 -3954 1852 -2944 7753 -133 -1094 1769 914 -4395 2209 -336 -9072 2708 -558 -2288 -6969 1698 -6005 -5455 1453 -8888 -9955 -2742 -2192 -6673 559...
output:
286710.963060
result:
ok found '286710.9630600', expected '286710.9630597', error '0.0000000'
Test #24:
score: 0
Accepted
time: 139ms
memory: 27472kb
input:
500 1000 1000 -2737 9170 -3092 -3722 -1781 -490 -2102 -8690 2357 -3625 -3893 -3745 1736 32 -1837 -883 -8835 -1112 -1014 1969 -9699 7959 9267 -9327 -2187 -2645 121 -2676 677 -7818 -5520 -6090 -707 -7734 8984 -7444 2534 1207 2308 2336 -3162 1651 -1604 -3273 481 -2629 -7583 4692 -8196 2876 -2706 -3116 ...
output:
395858.149518
result:
ok found '395858.1495180', expected '395858.1495181', error '0.0000000'
Test #25:
score: 0
Accepted
time: 202ms
memory: 44664kb
input:
700 1000 1000 4947 9196 -7193 -4647 -3136 -3511 -5519 -3791 5941 -2604 -3541 -4928 3034 -6698 -6971 -7187 -5272 4057 -9424 3848 3078 979 -152 -7513 7980 -4126 854 3952 -82 6589 -266 5151 8438 5411 -1611 -9443 912 -2348 8989 -6567 1228 -4983 -333 1525 4192 4287 1824 -4639 -4243 4431 3216 9158 -1758 -...
output:
637650.974409
result:
ok found '637650.9744090', expected '637650.9744090', error '0.0000000'
Test #26:
score: 0
Accepted
time: 231ms
memory: 47376kb
input:
800 1000 1000 -5351 9219 -2590 2097 -8416 -9612 6758 5229 -4327 1906 -3232 -5964 553 4435 -3910 4320 -7367 -4825 -8592 -3338 -6861 -4649 -3819 -714 -145 -209 -2121 2039 -8460 -8997 -3382 -6611 -8137 4624 1885 -3637 -1623 -725 6642 -7282 8685 9212 1259 -9544 -8945 5125 1864 -4133 2674 -1922 -9104 351...
output:
759351.883863
result:
ok found '759351.8838630', expected '759351.8838631', error '0.0000000'
Test #27:
score: 0
Accepted
time: 263ms
memory: 49924kb
input:
900 1000 1000 2856 9235 6656 -6886 -1550 9193 -7879 790 -2300 -1073 -3012 -6703 4982 -3176 4478 -3025 -778 -1807 -9273 -6952 -7759 6893 -1514 -3942 9614 -5497 1955 -2489 -4839 -4567 -8770 8394 2154 8743 -4737 6710 1247 9554 -992 -4388 -4955 5066 -2043 -6812 9759 1043 -4065 -2253 4453 -9621 -5136 -51...
output:
987999.278758
result:
ok found '987999.2787580', expected '987999.2787580', error '0.0000000'
Test #28:
score: 0
Accepted
time: 293ms
memory: 51444kb
input:
1000 1000 1000 1810 9255 -37 1995 2010 5545 7326 6698 -6420 -308 -2748 -7591 5956 -1415 -9799 -944 -1298 -4739 803 4033 -411 9850 -4961 609 -9571 -3416 2505 -5710 6401 2622 -254 -6368 -7371 -5975 7317 -5214 -2203 1887 7635 -9682 -1663 90 -5665 -8215 -7459 -4196 6608 -4677 8802 -3879 4305 4006 4323 -...
output:
1825100.380269
result:
ok found '1825100.3802690', expected '1825100.3802689', error '0.0000000'
Test #29:
score: 0
Accepted
time: 303ms
memory: 51484kb
input:
1000 1000 1000 -6902 -3387 2189 -4785 2673 -6027 8785 -9963 -626 -4522 1659 -2371 -7257 -6932 -9375 4135 9988 -2547 -5581 -4344 -555 4923 -4608 -4641 5912 -8176 6497 7117 -5931 -8260 -9677 -8546 -3542 -3892 -6043 -1941 9901 -1589 -9514 -8317 4047 3117 728 -6010 -6818 6729 -4233 -106 3918 4455 -6945 ...
output:
1671206.096142
result:
ok found '1671206.0961420', expected '1671206.0961422', error '0.0000000'