結果

問題 No.2769 Number of Rhombi
ユーザー H TH T
提出日時 2024-06-29 20:53:30
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 496 ms / 5,000 ms
コード長 794 bytes
コンパイル時間 1,813 ms
コンパイル使用メモリ 179,692 KB
実行使用メモリ 56,832 KB
最終ジャッジ日時 2024-06-29 20:53:45
合計ジャッジ時間 12,302 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 172 ms
15,104 KB
testcase_04 AC 156 ms
14,080 KB
testcase_05 AC 138 ms
11,392 KB
testcase_06 AC 208 ms
13,568 KB
testcase_07 AC 246 ms
15,744 KB
testcase_08 AC 240 ms
16,000 KB
testcase_09 AC 231 ms
15,872 KB
testcase_10 AC 225 ms
16,384 KB
testcase_11 AC 259 ms
16,768 KB
testcase_12 AC 236 ms
16,896 KB
testcase_13 AC 246 ms
17,536 KB
testcase_14 AC 276 ms
19,200 KB
testcase_15 AC 290 ms
20,608 KB
testcase_16 AC 334 ms
22,272 KB
testcase_17 AC 329 ms
25,216 KB
testcase_18 AC 381 ms
32,640 KB
testcase_19 AC 393 ms
35,200 KB
testcase_20 AC 423 ms
38,144 KB
testcase_21 AC 496 ms
44,416 KB
testcase_22 AC 496 ms
50,048 KB
testcase_23 AC 490 ms
56,832 KB
testcase_24 AC 2 ms
6,944 KB
testcase_25 AC 276 ms
17,664 KB
testcase_26 AC 284 ms
18,688 KB
testcase_27 AC 369 ms
25,344 KB
testcase_28 AC 299 ms
21,760 KB
testcase_29 AC 447 ms
39,296 KB
testcase_30 AC 320 ms
23,296 KB
testcase_31 AC 232 ms
17,024 KB
testcase_32 AC 233 ms
16,000 KB
testcase_33 AC 232 ms
16,128 KB
testcase_34 AC 230 ms
16,000 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:22:27: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [-Wc++17-extensions]
   22 |                 for (auto [x, y]: mp[{nx, ny}]) {
      |                           ^

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

map<pair<long long, long long>, vector<pair<long long, long long>>> mp;

int main() {
    int n;
    cin >> n;
    vector<long long> x(n);
    vector<long long> y(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i+1; j < n; j++) {
            long long tx = x[i]-x[j];
            long long ty = y[i]-y[j];
            long long nx = x[i]+x[j];
            long long ny = y[i]+y[j];
            if (mp.find({nx, ny}) != mp.end()) {
                for (auto [x, y]: mp[{nx, ny}]) {
                    if (tx*x + ty*y == 0) ans++;
                }
            } 
            mp[{nx, ny}].push_back({tx, ty});
        }
    }
    cout << ans << endl;
}
0