Task: | Closest points |
Sender: | aalto2024k_002 |
Submission time: | 2024-11-13 16:29:01 +0200 |
Language: | C++ (C++17) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.00 s | details |
#2 | WRONG ANSWER | 0.43 s | details |
#3 | WRONG ANSWER | 0.51 s | details |
#4 | WRONG ANSWER | 0.46 s | details |
#5 | WRONG ANSWER | 0.00 s | details |
#6 | WRONG ANSWER | 0.41 s | details |
#7 | WRONG ANSWER | 0.00 s | details |
#8 | WRONG ANSWER | 0.00 s | details |
#9 | WRONG ANSWER | 0.00 s | details |
#10 | WRONG ANSWER | 0.39 s | details |
#11 | WRONG ANSWER | 0.00 s | details |
#12 | WRONG ANSWER | 0.00 s | details |
#13 | WRONG ANSWER | 0.39 s | details |
#14 | WRONG ANSWER | 0.00 s | details |
#15 | WRONG ANSWER | 0.01 s | details |
#16 | WRONG ANSWER | 0.40 s | details |
#17 | WRONG ANSWER | 0.39 s | details |
#18 | WRONG ANSWER | 0.00 s | details |
Code
#include <bits/stdc++.h> using namespace std; long long distance(pair<long long, long long> p1, pair<long long, long long> p2) { return (p1.first - p2.first)*(p1.first - p2.first) + (p1.second - p2.second)*(p1.second - p2.second); } int main() { int n; cin >> n; vector<pair<long long, long long>> points(n); for (int i = 0; i < n; i++) { cin >> points[i].first >> points[i].second; } sort(points.begin(), points.end()); long long d = LONG_LONG_MAX; for (int i = 1; i < n; i++) { long long dist = distance(points[i], points[i-1]); cout << dist << endl; if (dist < d) { d = dist; } } cout << d << endl; }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
100 58 36 81 -7 46 49 87 -58 ... |
correct output |
---|
1 |
user output |
---|
4357 6925 122 29930 2501 ... Truncated |
Test 2
Verdict: WRONG ANSWER
input |
---|
200000 -222 -705 277 680 -436 561 528 -516 ... |
correct output |
---|
1 |
user output |
---|
100 196 121 2209 196 ... Truncated |
Test 3
Verdict: WRONG ANSWER
input |
---|
200000 -464738043 865360844 465231470 129093134 -276549869 -21946314 111055008 -48821736 ... |
correct output |
---|
25413170 |
user output |
---|
1911509496787892625 1318289563673034785 778005885270818425 17529938711399592 5612275444412 ... Truncated |
Test 4
Verdict: WRONG ANSWER
input |
---|
200000 1 513001000 2 689002000 3 785003000 4 799004000 ... |
correct output |
---|
1000000 |
user output |
---|
30976352001000001 9216192001000001 196028001000001 60024510001000001 242063016001000001 ... Truncated |
Test 5
Verdict: WRONG ANSWER
input |
---|
4 0 0 0 3 3 0 1 1 |
correct output |
---|
2 |
user output |
---|
9 5 5 5 |
Test 6
Verdict: WRONG ANSWER
input |
---|
200000 1 0 1 1 1 2 1 3 ... |
correct output |
---|
1 |
user output |
---|
1 1 1 1 1 ... Truncated |
Test 7
Verdict: WRONG ANSWER
input |
---|
4 1 2 10 3 3 5 8 5 |
correct output |
---|
8 |
user output |
---|
13 25 8 8 |
Test 8
Verdict: WRONG ANSWER
input |
---|
4 10 6 4 10 8 3 2 3 |
correct output |
---|
13 |
user output |
---|
53 65 13 13 |
Test 9
Verdict: WRONG ANSWER
input |
---|
2 -999999999 -999999999 999999999 999999999 |
correct output |
---|
7999999984000000008 |
user output |
---|
7999999984000000008 7999999984000000008 |
Test 10
Verdict: WRONG ANSWER
input |
---|
200000 0 1 1 1 2 1 3 1 ... |
correct output |
---|
1 |
user output |
---|
1 1 1 1 1 ... Truncated |
Test 11
Verdict: WRONG ANSWER
input |
---|
8 1 10000 -1 -10000 2 0 -2 0 ... |
correct output |
---|
16 |
user output |
---|
25 9604 100000001 400000004 100000001 ... |
Test 12
Verdict: WRONG ANSWER
input |
---|
3 -1000000000 -1000000000 1000000000 1000000000 0 0 |
correct output |
---|
2000000000000000000 |
user output |
---|
2000000000000000000 2000000000000000000 2000000000000000000 |
Test 13
Verdict: WRONG ANSWER
input |
---|
199999 1 1 2 1 3 1 4 1 ... |
correct output |
---|
1 |
user output |
---|
1 1 1 1 1 ... Truncated |
Test 14
Verdict: WRONG ANSWER
input |
---|
4 0 0 5 8 6 1 10000 0 |
correct output |
---|
37 |
user output |
---|
89 50 99880037 50 |
Test 15
Verdict: WRONG ANSWER
input |
---|
435 -842 -199 -480 798 -176 -406 792 608 ... |
correct output |
---|
2 |
user output |
---|
2253017 1868714 894965 146738 156816 ... Truncated |
Test 16
Verdict: WRONG ANSWER
input |
---|
200000 1 0 1 2 1 4 1 6 ... |
correct output |
---|
4 |
user output |
---|
4 4 4 4 4 ... Truncated |
Test 17
Verdict: WRONG ANSWER
input |
---|
200000 0 1 2 1 4 1 6 1 ... |
correct output |
---|
4 |
user output |
---|
4 4 4 4 4 ... Truncated |
Test 18
Verdict: WRONG ANSWER
input |
---|
3 -1000000000 -1000000000 1000000000 1000000000 1000000000 -1000000000 |
correct output |
---|
4000000000000000000 |
user output |
---|
4000000000000000000 4000000000000000000 4000000000000000000 |