| Task: | Pravokutni |
| Sender: | henrikaalto |
| Submission time: | 2019-07-31 13:59:26 +0300 |
| Language: | C++ (C++17) |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | WRONG ANSWER | 0 |
| test | verdict | time | |
|---|---|---|---|
| #1 | WRONG ANSWER | 0.01 s | details |
| #2 | WRONG ANSWER | 0.01 s | details |
| #3 | WRONG ANSWER | 0.01 s | details |
| #4 | WRONG ANSWER | 0.07 s | details |
| #5 | WRONG ANSWER | 0.09 s | details |
| #6 | WRONG ANSWER | 0.10 s | details |
| #7 | WRONG ANSWER | 0.15 s | details |
| #8 | WRONG ANSWER | 0.19 s | details |
| #9 | WRONG ANSWER | 0.25 s | details |
| #10 | WRONG ANSWER | 0.25 s | details |
Code
#include<bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define debug(...) #__VA_ARGS__ << ": " << __VA_ARGS__
using ii=long long;
#define x real()
#define y imag()
using pi=pair<int,int>;
using C=complex<ii>;
int clock_wise(C a, C c)
{
C b = {0, 0};
return ((c - a) * conj(b - a)).y > 0;
}
C points[1555];
// a ^ 2 + b ^ 2 = c ^ 2
// a ^ 2 + b ^ 2 < c ^ 2
ii dist(C a, C b)
{
ii ax = a.x - b.x;
ii ay = a.y - b.y;
return ax * ax + ay * ay;
}
int main()
{
int n;
cin >> n;
for (int i = 0; i < n; ++i) {
ii ax;
ii ay;
cin >> ax >> ay;
points[i] = {ax, ay};
}
int r = 0;
for (int i = 0; i < n; ++i) {
vector<C> p;
for (int j = 0; j < n; ++j) {
if (i == j) continue;
p.push_back(points[i] - points[j]);
}
sort(all(p), [&](C a, C b)
{
return clock_wise(a, b) < clock_wise(b, a);
}
);
C z = {0, 0};
int j = 0;
int t = -1;
for (int i = 1; i < n - 1; ++i) {
if (t != -1 && dist(z, p[i]) + dist(z, p[j]) == dist(p[i], p[j])) {
r += t;
continue;
}
t = -1;
while (j < i && dist(z, p[i]) + dist(z, p[j]) < dist(p[i], p[j])) j++;
if (dist(z, p[i]) + dist(z, p[j]) == dist(p[i], p[j])) {
t = 1;
while (j + 1 < i && dist(z, p[i]) + dist(z, p[j + 1]) == dist(p[i], p[j + 1])) ++j, ++t;
r += t;
}
}
}
cout << r << "\n";
}
Test details
Test 1
Verdict: WRONG ANSWER
| input |
|---|
| 11
2 1 7 7 0 0 -8 -7 ... |
| correct output |
|---|
| 8 |
| user output |
|---|
| 5 |
Test 2
Verdict: WRONG ANSWER
| input |
|---|
| 77
25 -19 -13 -11 -2 -24 -19 4 ... |
| correct output |
|---|
| 8082 |
| user output |
|---|
| 7003 |
Test 3
Verdict: WRONG ANSWER
| input |
|---|
| 219
2 -8 859 -3283 33 -49 2 -45 ... |
| correct output |
|---|
| 2533 |
| user output |
|---|
| 2037 |
Test 4
Verdict: WRONG ANSWER
| input |
|---|
| 751
-841 1308 -1603 -1143 657 -330 1565 1551 ... |
| correct output |
|---|
| 180 |
| user output |
|---|
| 162 |
Test 5
Verdict: WRONG ANSWER
| input |
|---|
| 887
-318 -111 -51 -42 -60 30 0 15 ... |
| correct output |
|---|
| 656682 |
| user output |
|---|
| 571111 |
Test 6
Verdict: WRONG ANSWER
| input |
|---|
| 979
-19978 14584 -19978 13600 22840 -19949 -19712 14218 ... |
| correct output |
|---|
| 217863 |
| user output |
|---|
| 168600 |
Test 7
Verdict: WRONG ANSWER
| input |
|---|
| 1240
509503063 -256406432 -487207177 245187456 -487207659 245185046 -392411792 -779758123 ... |
| correct output |
|---|
| 261035 |
| user output |
|---|
| 173170 |
Test 8
Verdict: WRONG ANSWER
| input |
|---|
| 1419
908609234 -961461577 908607806 -961461577 908608142 -961460058 908607491 -961461577 ... |
| correct output |
|---|
| 471204 |
| user output |
|---|
| 260826 |
Test 9
Verdict: WRONG ANSWER
| input |
|---|
| 1494
17337298 165736671 41562836 397321778 286305326 -29949683 392177969 -41024755 ... |
| correct output |
|---|
| 2984 |
| user output |
|---|
| 2263 |
Test 10
Verdict: WRONG ANSWER
| input |
|---|
| 1500
99601355 -35091687 142757373 -376358953 -233911476 -88725398 -3360747 -162507391 ... |
| correct output |
|---|
| 192311 |
| user output |
|---|
| 144545 |
