QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#708655 | #2455. Retribution! | Tenshi# | WA | 34ms | 8640kb | C++23 | 2.8kb | 2024-11-04 02:04:34 | 2024-11-04 02:04:34 |
Judging History
answer
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <tuple>
#include <iomanip>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define sz(x) (long long)(x).size()
bool comp(pair<long long, pair<int, int>> a, pair<long long, pair<int, int>> b) {
if (a.first < b.first) return true;
if (a.first > b.first) return false;
if (a.second.first < b.second.first) return true;
if (a.second.first > b.second.first) return false;
if (a.second.second < b.second.second) return true;
if (a.second.second > b.second.second) return false;
return 0;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int m, n, p;
cin >> m >> n >> p;
vector<tuple<int, int, int>> judges;
for (int i = 0 ; i < n; i++) {
int x, y;
cin >> x >> y;
judges.emplace_back(x, y, i);
}
vector<tuple<int, int, int>> tar;
for (int i = 0 ; i < m; i++) {
int x, y;
cin >> x >> y;
tar.emplace_back(x, y, i);
}
vector<tuple<int, int, int>> feather;
for (int i = 0 ; i < p; i++) {
int x, y;
cin >> x >> y;
feather.emplace_back(x, y, i);
}
vector<bool> judgeAssigned(n, false), tarAssigned(m, false), featherAssigned(p, false);
vector<pair<long long, pair<int, int>>> d;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
d.push_back({(get<0>(judges[i])-get<0>(tar[j]))*(get<0>(judges[i])-get<0>(tar[j])) +
(get<1>(judges[i])-get<1>(tar[j]))*(get<1>(judges[i])-get<1>(tar[j])),
{i, j}});
}
}
sort(d.begin(), d.end(), comp);
long double out = 0;
rep(i, sz(d)) {
if (judgeAssigned[d[i].second.first] or tarAssigned[d[i].second.second]) {
continue;
}
out+=sqrt(d[i].first);
judgeAssigned[d[i].second.first] = true;
tarAssigned[d[i].second.second] = true;
}
d.clear();
judgeAssigned = vector<bool>(n, false);
for (int i = 0; i < n; i++) {
for (int j = 0; j < p; j++) {
d.push_back({(get<0>(judges[i])-get<0>(feather[j]))*(get<0>(judges[i])-get<0>(feather[j])) +
(get<1>(judges[i])-get<1>(feather[j]))*(get<1>(judges[i])-get<1>(feather[j])),
{i, j}});
}
}
sort(d.begin(), d.end(), comp);
rep(i, sz(d)) {
if (judgeAssigned[d[i].second.first] or featherAssigned[d[i].second.second]) {
continue;
}
out+=sqrt(d[i].first);
judgeAssigned[d[i].second.first] = true;
featherAssigned[d[i].second.second] = true;
}
cout << setprecision(8) << fixed << out << endl;
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3804kb
input:
2 2 2 1 0 2 0 0 0 3 0 1 1 2 1
output:
4.00000000
result:
ok found '4.0000000', expected '4.0000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
1 1 1 5875 3435 -743 8951 2325 7352
output:
13901.68546026
result:
ok found '13901.6854603', expected '13901.6854603', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
2 2 2 0 0 10 0 6 0 20 0 6 0 20 0
output:
48.00000000
result:
ok found '48.0000000', expected '48.0000000', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3860kb
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.82245941
result:
ok found '157.8224594', expected '157.8224594', error '0.0000000'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3928kb
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.85021578
result:
ok found '150.8502158', expected '150.8502158', error '0.0000000'
Test #6:
score: 0
Accepted
time: 1ms
memory: 3856kb
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.31118619
result:
ok found '149.3111862', expected '149.3111862', error '0.0000000'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3792kb
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.46177963
result:
ok found '145.4617796', expected '145.4617796', error '0.0000000'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3848kb
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.02856560
result:
ok found '140.0285656', expected '140.0285656', error '0.0000000'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3868kb
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.89499366
result:
ok found '150.8949937', expected '150.8949937', error '0.0000000'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3836kb
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.08407835
result:
ok found '126.0840783', expected '126.0840784', error '0.0000000'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3844kb
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.08407835
result:
ok found '126.0840783', expected '126.0840784', error '0.0000000'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3872kb
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.08407835
result:
ok found '126.0840783', expected '126.0840784', error '0.0000000'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3840kb
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.95050642
result:
ok found '136.9505064', expected '136.9505064', error '0.0000000'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3860kb
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.95050642
result:
ok found '136.9505064', expected '136.9505064', error '0.0000000'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3836kb
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.95050642
result:
ok found '136.9505064', expected '136.9505064', error '0.0000000'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3796kb
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.00000000
result:
ok found '100.0000000', expected '100.0000000', error '0.0000000'
Test #17:
score: -100
Wrong Answer
time: 34ms
memory: 8640kb
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:
481481.28239198
result:
wrong answer 1st numbers differ - expected: '0.0000000', found: '481481.2823920', error = '481481.2823920'