結果
問題 | No.723 2つの数の和 |
ユーザー | Theta |
提出日時 | 2022-10-18 14:49:52 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 513 bytes |
コンパイル時間 | 481 ms |
コンパイル使用メモリ | 10,872 KB |
実行使用メモリ | 23,500 KB |
最終ジャッジ日時 | 2023-09-11 08:23:50 |
合計ジャッジ時間 | 3,389 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 19 ms
8,400 KB |
testcase_01 | AC | 18 ms
8,524 KB |
testcase_02 | AC | 19 ms
8,460 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 143 ms
22,776 KB |
testcase_14 | AC | 46 ms
13,088 KB |
testcase_15 | AC | 66 ms
16,720 KB |
testcase_16 | AC | 98 ms
21,364 KB |
testcase_17 | AC | 122 ms
21,580 KB |
testcase_18 | AC | 44 ms
10,288 KB |
testcase_19 | AC | 61 ms
19,980 KB |
testcase_20 | AC | 19 ms
8,584 KB |
testcase_21 | AC | 18 ms
8,396 KB |
testcase_22 | AC | 18 ms
8,468 KB |
testcase_23 | AC | 86 ms
23,500 KB |
testcase_24 | WA | - |
ソースコード
from collections import defaultdict def main(): N, X = map(int, input().split()) A = list(map(int, input().split())) A.sort() counter_A = defaultdict(int) for num in A: counter_A[num] += 1 patterns = 0 for num in A: if num > X - num: break if num == X - num: patterns += counter_A[num] ** 2 break patterns += counter_A[num] * counter_A[X - num] * 2 print(patterns) if __name__ == "__main__": main()