結果

問題 No.2517 Right Triangles on Circle
ユーザー InTheBloomInTheBloom
提出日時 2023-10-27 22:06:14
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 482 bytes
コンパイル時間 1,451 ms
コンパイル使用メモリ 164,056 KB
実行使用メモリ 29,968 KB
最終ジャッジ日時 2023-10-27 22:06:19
合計ジャッジ時間 4,130 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 109 ms
27,768 KB
testcase_14 AC 100 ms
27,768 KB
testcase_15 AC 129 ms
29,604 KB
testcase_16 AC 109 ms
29,356 KB
testcase_17 AC 91 ms
29,728 KB
testcase_18 AC 81 ms
27,588 KB
testcase_19 AC 71 ms
27,628 KB
testcase_20 AC 72 ms
27,680 KB
testcase_21 AC 103 ms
29,968 KB
testcase_22 AC 33 ms
10,812 KB
testcase_23 AC 83 ms
27,704 KB
testcase_24 AC 40 ms
10,996 KB
testcase_25 AC 27 ms
10,680 KB
testcase_26 AC 93 ms
29,816 KB
testcase_27 AC 30 ms
10,760 KB
testcase_28 AC 15 ms
7,316 KB
testcase_29 AC 36 ms
10,948 KB
testcase_30 AC 24 ms
10,112 KB
testcase_31 AC 82 ms
26,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

void main () {
    int N, M; readln.read(N, M);
    int[] A = readln.split.to!(int[]);

    solve(N, M, A);
}

void solve (int N, int M, int[] A) {
    /* 円周角の定理 */
    long ans = 0;
    bool[long] mp;
    foreach (a; A) mp[2*a] = true;

    foreach (a; A) if ((1L*2*a+M) in mp) ans += N-2;

    writeln(ans);
}

void read(T...)(string S, ref T args) {
    auto buf = S.split;
    foreach (i, ref arg; args) {
        arg = buf[i].to!(typeof(arg));
    }
}
0