結果
問題 | No.2769 Number of Rhombi |
ユーザー | Carpenters-Cat |
提出日時 | 2024-05-31 22:50:40 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 1,182 ms / 5,000 ms |
コード長 | 800 bytes |
コンパイル時間 | 2,546 ms |
コンパイル使用メモリ | 214,688 KB |
実行使用メモリ | 81,664 KB |
最終ジャッジ日時 | 2024-05-31 22:51:57 |
合計ジャッジ時間 | 35,171 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,812 KB |
testcase_01 | AC | 2 ms
6,944 KB |
testcase_02 | AC | 2 ms
6,944 KB |
testcase_03 | AC | 682 ms
57,088 KB |
testcase_04 | AC | 632 ms
49,920 KB |
testcase_05 | AC | 583 ms
34,944 KB |
testcase_06 | AC | 815 ms
43,520 KB |
testcase_07 | AC | 1,048 ms
52,992 KB |
testcase_08 | AC | 1,035 ms
55,808 KB |
testcase_09 | AC | 1,125 ms
60,416 KB |
testcase_10 | AC | 1,176 ms
67,200 KB |
testcase_11 | AC | 1,143 ms
72,576 KB |
testcase_12 | AC | 1,182 ms
76,544 KB |
testcase_13 | AC | 1,127 ms
79,232 KB |
testcase_14 | AC | 1,110 ms
80,896 KB |
testcase_15 | AC | 1,094 ms
81,152 KB |
testcase_16 | AC | 1,076 ms
81,280 KB |
testcase_17 | AC | 1,033 ms
81,408 KB |
testcase_18 | AC | 1,013 ms
81,536 KB |
testcase_19 | AC | 1,017 ms
81,536 KB |
testcase_20 | AC | 1,009 ms
81,664 KB |
testcase_21 | AC | 1,022 ms
81,408 KB |
testcase_22 | AC | 943 ms
81,536 KB |
testcase_23 | AC | 990 ms
81,408 KB |
testcase_24 | AC | 2 ms
6,944 KB |
testcase_25 | AC | 1,169 ms
79,104 KB |
testcase_26 | AC | 1,135 ms
80,384 KB |
testcase_27 | AC | 1,044 ms
81,408 KB |
testcase_28 | AC | 1,054 ms
81,152 KB |
testcase_29 | AC | 965 ms
81,536 KB |
testcase_30 | AC | 1,082 ms
81,280 KB |
testcase_31 | AC | 1,123 ms
76,544 KB |
testcase_32 | AC | 1,072 ms
56,064 KB |
testcase_33 | AC | 1,087 ms
56,064 KB |
testcase_34 | AC | 1,097 ms
65,024 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; ll gcd(ll a, ll b) { return (a ? gcd(b % a, a) : b); } void fmt(ll& a, ll& b) { if (a < 0) { a *= -1; b *= -1; } else if (a == 0 && b < 0) { b *= -1; } return; } int main () { int N; cin >> N; vector<pair<ll, ll>> A(N); for (auto& [a, b] : A) cin >> a >> b; using T = tuple<ll, ll, ll, ll>; map<T, ll> mp; ll ans = 0; for (int i = 0; i < N; i ++) { for (int j = i + 1; j < N; j ++) { auto [x1, y1] = A[i]; auto [x2, y2] = A[j]; ll m1 = x1 + x2, m2 = y1 + y2; ll d1 = x1 - x2, d2 = y1 - y2; ll g = gcd(abs(d1), abs(d2)); d1 /= g; d2 /= g; fmt(d1, d2); ll v1 = -1ll * d2, v2 = d1; fmt(v1, v2); ans += mp[T{m1, m2, v1, v2}]; mp[T{m1, m2, d1, d2}] ++; } } cout << ans << endl; }