QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#729554 | #2455. Retribution! | DJ_F | WA | 0ms | 3984kb | C++17 | 1.6kb | 2024-11-09 17:21:14 | 2024-11-09 17:21:31 |
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[i].x)*(jud[i].x-fea[i].x)+(jud[i].y-fea[i].y)*(jud[i].y-fea[i].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
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3916kb
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: 3820kb
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: -100
Wrong Answer
time: 0ms
memory: 3984kb
input:
2 2 2 0 0 10 0 6 0 20 0 6 0 20 0
output:
32.000000
result:
wrong answer 1st numbers differ - expected: '48.0000000', found: '32.0000000', error = '0.3333333'