Task: | Pravokutni |
Sender: | henrikaalto |
Submission time: | 2019-07-31 14:39:32 +0300 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | TIME LIMIT EXCEEDED | 0 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.01 s | details |
#2 | ACCEPTED | 0.01 s | details |
#3 | ACCEPTED | 0.02 s | details |
#4 | ACCEPTED | 0.17 s | details |
#5 | ACCEPTED | 0.20 s | details |
#6 | ACCEPTED | 0.26 s | details |
#7 | ACCEPTED | 0.44 s | details |
#8 | ACCEPTED | 0.38 s | details |
#9 | TIME LIMIT EXCEEDED | -- | details |
#10 | ACCEPTED | 0.86 s | details |
Compiler report
input/code.cpp:1:0: warning: ignoring #pragma GCC optmize [-Wunknown-pragmas] #pragma GCC optmize("O3")
Code
#pragma GCC optmize("O3") #include<bits/stdc++.h> using namespace std; #define all(x) x.begin(), x.end() using ii=long long; using pi=pair<ii,ii>; #define x first #define y second pi operator-(pi a, pi b) { return make_pair(a.x - b.x, a.y - b.y); } pi points[1555]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; for (int i = 0; i < n; ++i) { cin >> points[i].x >> points[i].y; } int r = 0; for (int it = 0; it < n; ++it) { vector<pi> p; vector<pi> v; for (int j = 0; j < n; ++j) { if (it == j) continue; pi z = points[it]-points[j]; ii u = abs(__gcd(z.x, z.y)); z.x /= u; z.y /= u; p.push_back(z); v.push_back(z); } sort(all(v)); vector<int>occ; for (int i = 0; i < n - 1; ++i) { int j = i + 1; while (v[i] == v[j]) ++j; occ.push_back(j - i); i = j - 1; } v.resize(unique(all(v)) - v.begin()); for (int i = 0; i < n - 1; ++i) { pi z = make_pair(p[i].y, -p[i].x); auto it = lower_bound(all(v), z); if (*it != z) continue; r += occ[it - v.begin()]; } } cout << r << "\n"; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
11
2 1 7 7 0 0 -8 -7 ... |
correct output |
---|
8 |
user output |
---|
8 |
Test 2
Verdict: ACCEPTED
input |
---|
77
25 -19 -13 -11 -2 -24 -19 4 ... |
correct output |
---|
8082 |
user output |
---|
8082 |
Test 3
Verdict: ACCEPTED
input |
---|
219
2 -8 859 -3283 33 -49 2 -45 ... |
correct output |
---|
2533 |
user output |
---|
2533 |
Test 4
Verdict: ACCEPTED
input |
---|
751
-841 1308 -1603 -1143 657 -330 1565 1551 ... |
correct output |
---|
180 |
user output |
---|
180 |
Test 5
Verdict: ACCEPTED
input |
---|
887
-318 -111 -51 -42 -60 30 0 15 ... |
correct output |
---|
656682 |
user output |
---|
656682 |
Test 6
Verdict: ACCEPTED
input |
---|
979
-19978 14584 -19978 13600 22840 -19949 -19712 14218 ... |
correct output |
---|
217863 |
user output |
---|
217863 |
Test 7
Verdict: ACCEPTED
input |
---|
1240
509503063 -256406432 -487207177 245187456 -487207659 245185046 -392411792 -779758123 ... |
correct output |
---|
261035 |
user output |
---|
261035 |
Test 8
Verdict: ACCEPTED
input |
---|
1419
908609234 -961461577 908607806 -961461577 908608142 -961460058 908607491 -961461577 ... |
correct output |
---|
471204 |
user output |
---|
471204 |
Test 9
Verdict: TIME LIMIT EXCEEDED
input |
---|
1494
17337298 165736671 41562836 397321778 286305326 -29949683 392177969 -41024755 ... |
correct output |
---|
2984 |
user output |
---|
(empty) |
Test 10
Verdict: ACCEPTED
input |
---|
1500
99601355 -35091687 142757373 -376358953 -233911476 -88725398 -3360747 -162507391 ... |
correct output |
---|
192311 |
user output |
---|
192311 |