QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#729507#2455. Retribution!DJ_FWA 19ms6220kbC++171.8kb2024-11-09 17:14:332024-11-09 17:14:47

Judging History

你现在查看的是最新测评结果

  • [2024-11-09 17:14:47]
  • 评测
  • 测评结果:WA
  • 用时:19ms
  • 内存:6220kb
  • [2024-11-09 17:14:33]
  • 提交

answer

#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<iomanip>
#include<cstring>
#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;
} d1[N];
double dis(note a,note b){
    return sqrt((a.x-b.x)  *  ( a.x-b.x) + ( a.y-b.y) *(a.y-b.y));
}
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;
}
vector<edge> vec;
bool vis[N], vis1[N];
void work(int x)
{
    vec.clear();
    memset(vis, 0, sizeof(vis));
    memset(vis1, 0, sizeof(vis1));
    memset(fea, 0, sizeof(fea));
    int cnt=0;
    for(int i=1; i<=x; i++)
    {
        cin>>fea[i].x>>fea[i].y;
    }

    cnt = 0;
    memset(vis,0,sizeof(vis));
    memset(vis1,0,sizeof(vis1));
    memset(d1,0,sizeof(d1));
    for(int i = 1; i<=n; i++)
    {
        for(int j = 1; j<=p; j++)
        {
            d1[cnt].l = dis(jud[i],fea[j]);
            d1[cnt].a = i;
            d1[cnt].b = j;
            cnt++;
        }
    }
    sort(d1,d1+cnt,cmp);
    for(int i = 0; i<cnt; i++)
    {
        if(vis[d1[i].a]==0 && vis1[d1[i].b]==0)
        {
            vis[d1[i].a]=1;
            vis1[d1[i].b]=1;
            ans += d1[i].l;
        }
    }
}
void solve()
{
    cin>>n>>m>>p;
    for(int i=1; i<=n; i++)
    {
        cin>>jud[i].x>>jud[i].y;
    }
    work(m);
    work(p);
    printf("%.6lf",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++)
2 2 0
0 0
0 -2
0 -1
0 1
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 4024kb

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: 4084kb

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: 4024kb

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: 4076kb

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: 4012kb

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: 1ms
memory: 3908kb

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: 4020kb

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: 3896kb

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: 4020kb

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: 4084kb

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: 3828kb

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: 1ms
memory: 3888kb

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: 3916kb

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: 4028kb

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: 4068kb

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: 4012kb

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: -100
Wrong Answer
time: 19ms
memory: 6220kb

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:

1082.938963

result:

wrong answer 1st numbers differ - expected: '0.0000000', found: '1082.9389630', error = '1082.9389630'