Task: | Zig Zag |
Sender: | aalto2024k_006 |
Submission time: | 2024-11-13 16:59:13 +0200 |
Language: | C++ (C++17) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.00 s | details |
#2 | WRONG ANSWER | 0.00 s | details |
#3 | WRONG ANSWER | 0.00 s | details |
#4 | WRONG ANSWER | 0.00 s | details |
#5 | WRONG ANSWER | 0.01 s | details |
#6 | WRONG ANSWER | 0.00 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.00 s | details |
#11 | WRONG ANSWER | 0.00 s | details |
#12 | WRONG ANSWER | 0.00 s | details |
#13 | WRONG ANSWER | 0.00 s | details |
#14 | WRONG ANSWER | 0.00 s | details |
#15 | WRONG ANSWER | 0.00 s | details |
#16 | WRONG ANSWER | 0.00 s | details |
#17 | WRONG ANSWER | 0.00 s | details |
#18 | WRONG ANSWER | 0.00 s | details |
#19 | WRONG ANSWER | 0.00 s | details |
#20 | WRONG ANSWER | 0.00 s | details |
#21 | WRONG ANSWER | 0.00 s | details |
#22 | WRONG ANSWER | 0.00 s | details |
#23 | WRONG ANSWER | 0.00 s | details |
#24 | WRONG ANSWER | 0.00 s | details |
#25 | WRONG ANSWER | 0.00 s | details |
#26 | WRONG ANSWER | 0.00 s | details |
#27 | WRONG ANSWER | 0.00 s | details |
#28 | WRONG ANSWER | 0.00 s | details |
#29 | WRONG ANSWER | 0.00 s | details |
#30 | WRONG ANSWER | 0.00 s | details |
#31 | WRONG ANSWER | 0.00 s | details |
#32 | WRONG ANSWER | 0.00 s | details |
#33 | WRONG ANSWER | 0.00 s | details |
#34 | WRONG ANSWER | 0.00 s | details |
#35 | WRONG ANSWER | 0.00 s | details |
#36 | WRONG ANSWER | 0.00 s | details |
#37 | WRONG ANSWER | 0.00 s | details |
#38 | WRONG ANSWER | 0.00 s | details |
#39 | WRONG ANSWER | 0.00 s | details |
#40 | WRONG ANSWER | 0.00 s | details |
#41 | WRONG ANSWER | 0.00 s | details |
#42 | WRONG ANSWER | 0.00 s | details |
#43 | WRONG ANSWER | 0.00 s | details |
#44 | WRONG ANSWER | 0.00 s | details |
#45 | WRONG ANSWER | 0.00 s | details |
#46 | WRONG ANSWER | 0.00 s | details |
#47 | WRONG ANSWER | 0.00 s | details |
#48 | WRONG ANSWER | 0.00 s | details |
#49 | WRONG ANSWER | 0.00 s | details |
#50 | WRONG ANSWER | 0.00 s | details |
#51 | WRONG ANSWER | 0.00 s | details |
#52 | WRONG ANSWER | 0.00 s | details |
#53 | WRONG ANSWER | 0.00 s | details |
#54 | WRONG ANSWER | 0.00 s | details |
#55 | WRONG ANSWER | 0.00 s | details |
#56 | WRONG ANSWER | 0.00 s | details |
#57 | WRONG ANSWER | 0.00 s | details |
#58 | WRONG ANSWER | 0.00 s | details |
#59 | WRONG ANSWER | 0.01 s | details |
#60 | WRONG ANSWER | 0.01 s | details |
#61 | WRONG ANSWER | 0.01 s | details |
#62 | WRONG ANSWER | 0.01 s | details |
#63 | WRONG ANSWER | 0.01 s | details |
#64 | WRONG ANSWER | 0.01 s | details |
#65 | WRONG ANSWER | 0.01 s | details |
#66 | WRONG ANSWER | 0.01 s | details |
#67 | WRONG ANSWER | 0.01 s | details |
#68 | WRONG ANSWER | 0.01 s | details |
Compiler report
input/code.cpp: In function 'll minD(std::vector<std::pair<long long int, long long int> >)': input/code.cpp:23:14: warning: variable 'it' set but not used [-Wunused-but-set-variable] 23 | auto it = activePs.begin(); | ^~
Code
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> P; ll dist(P P1, P P2) { return (P2.first - P1.first) * (P2.first - P1.first) + (P2.second - P1.second) * (P2.second - P1.second); } ll minD(vector<P> Ps){ ll minS = LLONG_MAX; ll n = Ps.size(); sort(Ps.begin(), Ps.end()); set<P> activePs = {{Ps[0].second, Ps[0].first}}; ll j = 0; for (ll i = 1; i < n; i++) { auto it = activePs.begin(); ll dd = ceil(sqrt(minS)); while (j < i && Ps[j].first < Ps[i].first - dd) { activePs.erase({Ps[j].second, Ps[j].first}); j++; } auto lowerBound = activePs.lower_bound({Ps[i].second - dd, 0}); auto upperBound = activePs.upper_bound({Ps[i].second + dd, 0}); for (auto it = lowerBound; it != upperBound; it++) { minS = min(minS, dist({it->second, it->first}, Ps[i])); } activePs.insert({Ps[i].second, Ps[i].first}); } return minS; } int main(){ ll n; cin >> n; vector<P> vec(n); for(int i=0; i<n; i++){ ll a,b; cin >> a >> b; vec[i]=make_pair(a,b); } cout << minD(vec) << endl; }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
2 2 5 8 9 |
correct output |
---|
1 2 |
user output |
---|
52 |
Test 2
Verdict: WRONG ANSWER
input |
---|
3 3 9 8 7 9 9 |
correct output |
---|
1 3 2 |
user output |
---|
5 |
Test 3
Verdict: WRONG ANSWER
input |
---|
3 6 10 8 7 9 4 |
correct output |
---|
1 3 2 |
user output |
---|
10 |
Test 4
Verdict: WRONG ANSWER
input |
---|
3 1 2 2 6 9 9 |
correct output |
---|
1 3 2 |
user output |
---|
17 |
Test 5
Verdict: WRONG ANSWER
input |
---|
3 3 4 6 1 6 4 |
correct output |
---|
1 2 3 |
user output |
---|
9 |
Test 6
Verdict: WRONG ANSWER
input |
---|
3 2 9 3 2 6 9 |
correct output |
---|
1 2 3 |
user output |
---|
16 |
Test 7
Verdict: WRONG ANSWER
input |
---|
4 2 10 6 5 7 1 9 3 |
correct output |
---|
1 3 2 4 |
user output |
---|
8 |
Test 8
Verdict: WRONG ANSWER
input |
---|
4 1 5 2 3 3 8 8 5 |
correct output |
---|
1 4 2 3 |
user output |
---|
5 |
Test 9
Verdict: WRONG ANSWER
input |
---|
4 2 7 5 4 7 3 10 1 |
correct output |
---|
1 4 2 3 |
user output |
---|
5 |
Test 10
Verdict: WRONG ANSWER
input |
---|
4 1 5 4 3 4 8 10 3 |
correct output |
---|
1 4 3 2 |
user output |
---|
13 |
Test 11
Verdict: WRONG ANSWER
input |
---|
4 1 9 4 7 4 8 5 5 |
correct output |
---|
1 4 3 2 |
user output |
---|
1 |
Test 12
Verdict: WRONG ANSWER
input |
---|
4 1 6 3 2 4 9 9 4 |
correct output |
---|
1 4 3 2 |
user output |
---|
18 |
Test 13
Verdict: WRONG ANSWER
input |
---|
4 3 1 5 10 6 3 9 8 |
correct output |
---|
1 2 3 4 |
user output |
---|
13 |
Test 14
Verdict: WRONG ANSWER
input |
---|
4 1 7 6 6 8 6 9 3 |
correct output |
---|
1 4 2 3 |
user output |
---|
4 |
Test 15
Verdict: WRONG ANSWER
input |
---|
4 4 10 6 1 7 4 9 3 |
correct output |
---|
1 2 4 3 |
user output |
---|
5 |
Test 16
Verdict: WRONG ANSWER
input |
---|
4 1 9 6 4 7 3 8 3 |
correct output |
---|
1 4 2 3 |
user output |
---|
1 |
Test 17
Verdict: WRONG ANSWER
input |
---|
4 1 2 6 10 7 3 10 5 |
correct output |
---|
1 4 2 3 |
user output |
---|
13 |
Test 18
Verdict: WRONG ANSWER
input |
---|
4 4 7 9 5 9 9 10 5 |
correct output |
---|
1 4 3 2 |
user output |
---|
1 |
Test 19
Verdict: WRONG ANSWER
input |
---|
5 5 7 6 6 6 9 7 9 ... |
correct output |
---|
1 5 2 4 3 |
user output |
---|
1 |
Test 20
Verdict: WRONG ANSWER
input |
---|
5 1 2 2 3 4 10 5 10 ... |
correct output |
---|
1 5 2 4 3 |
user output |
---|
1 |
Test 21
Verdict: WRONG ANSWER
input |
---|
5 1 10 5 2 5 4 5 5 ... |
correct output |
---|
1 2 5 3 4 |
user output |
---|
1 |
Test 22
Verdict: WRONG ANSWER
input |
---|
5 3 2 6 1 6 6 8 9 ... |
correct output |
---|
1 4 2 3 5 |
user output |
---|
10 |
Test 23
Verdict: WRONG ANSWER
input |
---|
5 6 2 7 6 8 7 10 9 ... |
correct output |
---|
1 5 2 4 3 |
user output |
---|
1 |
Test 24
Verdict: WRONG ANSWER
input |
---|
5 3 1 3 4 5 1 9 9 ... |
correct output |
---|
1 5 3 4 2 |
user output |
---|
2 |
Test 25
Verdict: WRONG ANSWER
input |
---|
5 1 4 2 10 4 3 9 1 ... |
correct output |
---|
1 5 4 2 3 |
user output |
---|
10 |
Test 26
Verdict: WRONG ANSWER
input |
---|
5 1 3 5 10 8 4 8 5 ... |
correct output |
---|
1 5 2 3 4 |
user output |
---|
1 |
Test 27
Verdict: WRONG ANSWER
input |
---|
5 3 5 6 9 9 1 9 4 ... |
correct output |
---|
1 5 2 3 4 |
user output |
---|
2 |
Test 28
Verdict: WRONG ANSWER
input |
---|
5 1 4 2 1 2 4 5 1 ... |
correct output |
---|
1 5 2 3 4 |
user output |
---|
1 |
Test 29
Verdict: WRONG ANSWER
input |
---|
10 4 5 5 3 5 7 6 6 ... |
correct output |
---|
1 9 5 10 7 2 8 6 3 4 |
user output |
---|
1 |
Test 30
Verdict: WRONG ANSWER
input |
---|
10 1 2 1 4 2 3 2 4 ... |
correct output |
---|
1 10 2 8 3 6 4 9 7 5 |
user output |
---|
1 |
Test 31
Verdict: WRONG ANSWER
input |
---|
10 1 10 3 5 3 7 4 2 ... |
correct output |
---|
1 9 8 4 10 5 3 6 2 7 |
user output |
---|
1 |
Test 32
Verdict: WRONG ANSWER
input |
---|
10 1 1 2 1 3 2 3 3 ... |
correct output |
---|
1 8 2 10 3 9 5 6 7 4 |
user output |
---|
1 |
Test 33
Verdict: WRONG ANSWER
input |
---|
10 1 7 3 2 3 10 5 7 ... |
correct output |
---|
1 8 3 5 10 2 9 4 7 6 |
user output |
---|
1 |
Test 34
Verdict: WRONG ANSWER
input |
---|
10 2 9 3 1 3 4 3 10 ... |
correct output |
---|
1 5 10 2 9 3 4 8 6 7 |
user output |
---|
1 |
Test 35
Verdict: WRONG ANSWER
input |
---|
10 1 4 2 10 4 3 4 5 ... |
correct output |
---|
1 10 6 2 9 8 3 7 4 5 |
user output |
---|
2 |
Test 36
Verdict: WRONG ANSWER
input |
---|
10 1 3 1 5 3 1 5 6 ... |
correct output |
---|
1 10 2 8 5 3 9 6 4 7 |
user output |
---|
1 |
Test 37
Verdict: WRONG ANSWER
input |
---|
10 1 7 3 5 5 5 5 8 ... |
correct output |
---|
1 8 5 10 2 9 7 6 4 3 |
user output |
---|
2 |
Test 38
Verdict: WRONG ANSWER
input |
---|
10 1 4 2 1 2 4 3 2 ... |
correct output |
---|
1 10 5 7 3 9 2 6 4 8 |
user output |
---|
1 |
Test 39
Verdict: WRONG ANSWER
input |
---|
100 5041736 157240647 20175393 348043754 21461600 42077569 21590319 177103472 ... |
correct output |
---|
1 95 3 98 4 99 10 81 29 7 96 8... |
user output |
---|
11052930848962 |
Test 40
Verdict: WRONG ANSWER
input |
---|
100 122816 137572579 3081988 829722338 16987929 288837678 20795114 89789519 ... |
correct output |
---|
1 94 4 90 14 97 21 96 3 99 8 9... |
user output |
---|
63287537234596 |
Test 41
Verdict: WRONG ANSWER
input |
---|
100 13977261 381987546 27435119 390118206 27838076 590195590 29208319 801689376 ... |
correct output |
---|
1 100 9 94 14 77 12 99 2 97 7 ... |
user output |
---|
35714222965690 |
Test 42
Verdict: WRONG ANSWER
input |
---|
100 24822301 241650433 25750352 822299809 32079340 156090008 55262494 100450154 ... |
correct output |
---|
1 100 4 99 3 87 11 77 12 64 20... |
user output |
---|
3038952431177 |
Test 43
Verdict: WRONG ANSWER
input |
---|
100 5539596 212262730 9648746 657694080 20427661 42713839 23212898 52113136 ... |
correct output |
---|
1 94 3 91 4 88 7 81 14 75 28 6... |
user output |
---|
5831204664706 |
Test 44
Verdict: WRONG ANSWER
input |
---|
100 1763267 741881723 6157975 278203924 21895078 521944783 24624220 604717980 ... |
correct output |
---|
1 100 16 97 24 77 23 94 15 70 ... |
user output |
---|
38059989902813 |
Test 45
Verdict: WRONG ANSWER
input |
---|
100 39308105 838098679 44426603 836947476 51198751 708680148 63176060 437557708 ... |
correct output |
---|
1 99 2 96 5 100 3 97 11 71 25 ... |
user output |
---|
17324536356898 |
Test 46
Verdict: WRONG ANSWER
input |
---|
100 26735342 806125341 42569672 497138595 70798611 724056782 77364316 450297483 ... |
correct output |
---|
1 97 6 100 3 98 10 94 25 78 41... |
user output |
---|
82425468138610 |
Test 47
Verdict: WRONG ANSWER
input |
---|
100 8921056 150015577 14394691 72903212 22850648 457512559 27825976 466880371 ... |
correct output |
---|
1 81 5 99 2 83 11 54 96 12 88 ... |
user output |
---|
112509790374928 |
Test 48
Verdict: WRONG ANSWER
input |
---|
100 4900393 476861950 8745675 461759249 11139168 391337048 37347058 286446807 ... |
correct output |
---|
1 97 6 87 24 84 17 93 25 94 5 ... |
user output |
---|
107996007151085 |
Test 49
Verdict: WRONG ANSWER
input |
---|
200 5041736 157240647 12577900 821317682 20175393 348043754 21461600 42077569 ... |
correct output |
---|
1 186 4 183 15 195 5 196 20 19... |
user output |
---|
11052930848962 |
Test 50
Verdict: WRONG ANSWER
input |
---|
200 122816 137572579 3081988 829722338 8592846 688876470 16987929 288837678 ... |
correct output |
---|
1 186 6 200 9 182 31 177 29 19... |
user output |
---|
13103059139210 |
Test 51
Verdict: WRONG ANSWER
input |
---|
200 5007418 457386905 9071363 177024747 11005899 132698 13977261 381987546 ... |
correct output |
---|
1 197 3 180 5 195 6 199 19 166... |
user output |
---|
1648756474768 |
Test 52
Verdict: WRONG ANSWER
input |
---|
200 24822301 241650433 25750352 822299809 27410345 98925543 32079340 156090008 ... |
correct output |
---|
1 198 5 187 3 197 6 170 19 151... |
user output |
---|
3038952431177 |
Test 53
Verdict: WRONG ANSWER
input |
---|
200 4210032 63222017 5539596 212262730 9648746 657694080 17149028 626575097 ... |
correct output |
---|
1 191 6 186 7 181 13 159 11 16... |
user output |
---|
1586207211605 |
Test 54
Verdict: WRONG ANSWER
input |
---|
200 1763267 741881723 6157975 278203924 13795513 320861635 21895078 521944783 ... |
correct output |
---|
1 200 28 182 41 187 40 192 18 ... |
user output |
---|
5031845089009 |
Test 55
Verdict: WRONG ANSWER
input |
---|
200 8476925 141485410 8505126 166581265 12461681 74039645 15361440 452562087 ... |
correct output |
---|
1 192 3 196 18 186 2 177 28 18... |
user output |
---|
17324536356898 |
Test 56
Verdict: WRONG ANSWER
input |
---|
200 1991410 698069978 7670036 191583196 8822402 685559485 11360091 77004696 ... |
correct output |
---|
1 198 6 192 14 199 7 200 3 194... |
user output |
---|
1661572122964 |
Test 57
Verdict: WRONG ANSWER
input |
---|
200 4472345 555680129 7737822 978991670 8921056 150015577 14394691 72903212 ... |
correct output |
---|
1 191 2 188 24 177 22 200 8 18... |
user output |
---|
11961242572849 |
Test 58
Verdict: WRONG ANSWER
input |
---|
200 366794 310416436 4900393 476861950 8745675 461759249 11139168 391337048 ... |
correct output |
---|
1 197 13 193 7 187 39 172 32 1... |
user output |
---|
18934777540709 |
Test 59
Verdict: WRONG ANSWER
input |
---|
1000 4982121 854709206 5051980 969850608 6610770 110841534 7756396 54539209 ... |
correct output |
---|
1 933 2 989 10 938 11 977 45 9... |
user output |
---|
228730567754 |
Test 60
Verdict: WRONG ANSWER
input |
---|
1000 692639 597387122 870901 527592476 3407540 258414659 3706190 578214810 ... |
correct output |
---|
1 987 30 901 17 997 81 942 82 ... |
user output |
---|
217115084682 |
Test 61
Verdict: WRONG ANSWER
input |
---|
1000 52022 846049438 151015 375423447 798369 995844330 1351954 659601047 ... |
correct output |
---|
1 997 3 944 28 957 6 998 23 90... |
user output |
---|
405366661405 |
Test 62
Verdict: WRONG ANSWER
input |
---|
1000 1296052 600889338 1645696 768715355 2692564 473274745 3499475 38421523 ... |
correct output |
---|
1 991 59 989 9 958 13 954 80 9... |
user output |
---|
479171078425 |
Test 63
Verdict: WRONG ANSWER
input |
---|
1000 1126577 499684443 1256131 518722321 5616399 179078305 7506590 750644416 ... |
correct output |
---|
1 993 32 934 82 982 65 913 29 ... |
user output |
---|
143918069140 |
Test 64
Verdict: WRONG ANSWER
input |
---|
2000 40804 71218080 59095 459895029 423473 9299604 685308 815211163 ... |
correct output |
---|
1 1989 3 1970 60 1943 34 1941 ... |
user output |
---|
7640451666 |
Test 65
Verdict: WRONG ANSWER
input |
---|
2000 1408858 277110806 2161135 364884754 2812466 979975883 4200717 277590999 ... |
correct output |
---|
1 1975 45 1898 108 1892 134 19... |
user output |
---|
145888364093 |
Test 66
Verdict: WRONG ANSWER
input |
---|
2000 1709459 406796814 1857492 878587442 2005566 168482214 3426573 973328677 ... |
correct output |
---|
1 2000 31 1928 12 1994 41 1940... |
user output |
---|
43509308033 |
Test 67
Verdict: WRONG ANSWER
input |
---|
2000 554335 614887580 2154289 832986059 2227123 110013552 2614185 311227898 ... |
correct output |
---|
1 1977 10 1981 33 1908 34 1978... |
user output |
---|
33136689317 |
Test 68
Verdict: WRONG ANSWER
input |
---|
2000 890991 100455230 1036021 428733862 1938719 436899661 2001873 863975225 ... |
correct output |
---|
1 1998 24 1999 48 1994 53 1950... |
user output |
---|
228103427890 |