Task: | Closest points |
Sender: | aalto2024k_005 |
Submission time: | 2024-11-13 16:44:09 +0200 |
Language: | C++ (C++17) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.00 s | details |
#2 | WRONG ANSWER | 0.07 s | details |
#3 | WRONG ANSWER | 0.09 s | details |
#4 | WRONG ANSWER | 0.07 s | details |
#5 | WRONG ANSWER | 0.00 s | details |
#6 | ACCEPTED | 0.05 s | details |
#7 | WRONG ANSWER | 0.00 s | details |
#8 | WRONG ANSWER | 0.00 s | details |
#9 | ACCEPTED | 0.00 s | details |
#10 | ACCEPTED | 0.05 s | details |
#11 | WRONG ANSWER | 0.00 s | details |
#12 | ACCEPTED | 0.00 s | details |
#13 | ACCEPTED | 0.05 s | details |
#14 | WRONG ANSWER | 0.01 s | details |
#15 | WRONG ANSWER | 0.00 s | details |
#16 | ACCEPTED | 0.05 s | details |
#17 | ACCEPTED | 0.05 s | details |
#18 | ACCEPTED | 0.00 s | details |
Code
#include <bits/stdc++.h> using namespace std; //Definitions for quicker writing #define REP(i,a,b) for (int i = a; i < b; i++) #define clz __builtin_clz #define ctz __builtin_ctz #define popct __builtin_popcount #define PB push_back #define MP make_pair #define F first #define S second #define X real() #define Y imag() //Typedefs for quicker writing typedef long long ll; typedef vector<int> vi; typedef vector<long long> vl; typedef pair<int,int> pi; typedef pair<long long, long long> pl; typedef complex<long long> po; //Max values const long long lmx = LLONG_MAX; const int imx = INT_MAX; double cross(po v, po w){ return v.X * w.Y - v.Y * w.X; } ll euclidean(po v, po w){ ll x1,x2,y1,y2; x1 = v.X; x2 = w.X; y1 = v.Y; y2 = w.Y; ll sum; sum = (x2-x1)*(x2-x1)+(y2-y1)*(y2-y1); return sum; } bool comp(const po &a, const po &b) { return (a.X == b.X) ? (a.Y < b.Y) : (a.X < b.X); } int main() { //IO optimization ios::sync_with_stdio(0); cin.tie(0); //Input definition ll n; //Read In cin >> n; po points[n]; ll a,b; REP(i,0,n){ cin >> a >> b; points[i] = {a,b}; } //Main part sort(points,points+n, comp); ll x,y; ll d = euclidean(points[0],points[1]); REP(i,1,n){ x = points[i].X; y = points[i].Y; for(int j = i-1; j >= 0; j--){ if(points[j].X > x-d && points[j].Y < y+d && points[j].Y < y-d){ if(euclidean(points[j],points[i]) < d) d = euclidean(points[i],points[j]); } else{ break; } } } //Write out cout << d << "\n"; //Return return 0; }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
100 58 36 81 -7 46 49 87 -58 ... |
correct output |
---|
1 |
user output |
---|
4357 |
Test 2
Verdict: WRONG ANSWER
input |
---|
200000 -222 -705 277 680 -436 561 528 -516 ... |
correct output |
---|
1 |
user output |
---|
100 |
Test 3
Verdict: WRONG ANSWER
input |
---|
200000 -464738043 865360844 465231470 129093134 -276549869 -21946314 111055008 -48821736 ... |
correct output |
---|
25413170 |
user output |
---|
1911509496787892625 |
Test 4
Verdict: WRONG ANSWER
input |
---|
200000 1 513001000 2 689002000 3 785003000 4 799004000 ... |
correct output |
---|
1000000 |
user output |
---|
30976352001000001 |
Test 5
Verdict: WRONG ANSWER
input |
---|
4 0 0 0 3 3 0 1 1 |
correct output |
---|
2 |
user output |
---|
9 |
Test 6
Verdict: ACCEPTED
input |
---|
200000 1 0 1 1 1 2 1 3 ... |
correct output |
---|
1 |
user output |
---|
1 |
Test 7
Verdict: WRONG ANSWER
input |
---|
4 1 2 10 3 3 5 8 5 |
correct output |
---|
8 |
user output |
---|
13 |
Test 8
Verdict: WRONG ANSWER
input |
---|
4 10 6 4 10 8 3 2 3 |
correct output |
---|
13 |
user output |
---|
53 |
Test 9
Verdict: ACCEPTED
input |
---|
2 -999999999 -999999999 999999999 999999999 |
correct output |
---|
7999999984000000008 |
user output |
---|
7999999984000000008 |
Test 10
Verdict: ACCEPTED
input |
---|
200000 0 1 1 1 2 1 3 1 ... |
correct output |
---|
1 |
user output |
---|
1 |
Test 11
Verdict: WRONG ANSWER
input |
---|
8 1 10000 -1 -10000 2 0 -2 0 ... |
correct output |
---|
16 |
user output |
---|
25 |
Test 12
Verdict: ACCEPTED
input |
---|
3 -1000000000 -1000000000 1000000000 1000000000 0 0 |
correct output |
---|
2000000000000000000 |
user output |
---|
2000000000000000000 |
Test 13
Verdict: ACCEPTED
input |
---|
199999 1 1 2 1 3 1 4 1 ... |
correct output |
---|
1 |
user output |
---|
1 |
Test 14
Verdict: WRONG ANSWER
input |
---|
4 0 0 5 8 6 1 10000 0 |
correct output |
---|
37 |
user output |
---|
89 |
Test 15
Verdict: WRONG ANSWER
input |
---|
435 -842 -199 -480 798 -176 -406 792 608 ... |
correct output |
---|
2 |
user output |
---|
2253017 |
Test 16
Verdict: ACCEPTED
input |
---|
200000 1 0 1 2 1 4 1 6 ... |
correct output |
---|
4 |
user output |
---|
4 |
Test 17
Verdict: ACCEPTED
input |
---|
200000 0 1 2 1 4 1 6 1 ... |
correct output |
---|
4 |
user output |
---|
4 |
Test 18
Verdict: ACCEPTED
input |
---|
3 -1000000000 -1000000000 1000000000 1000000000 1000000000 -1000000000 |
correct output |
---|
4000000000000000000 |
user output |
---|
4000000000000000000 |