結果

問題 No.3067 +10 Seconds Clock
ユーザー lam6er
提出日時 2025-04-16 00:10:56
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 459 bytes
コンパイル時間 323 ms
コンパイル使用メモリ 82,288 KB
実行使用メモリ 127,476 KB
最終ジャッジ日時 2025-04-16 00:12:36
合計ジャッジ時間 3,221 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 1 WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from collections import Counter

def main():
    input = sys.stdin.read().split()
    n = int(input[0])
    a = list(map(int, input[1:n+1]))
    counter = Counter(a)
    s = n + 1
    ans = 0
    for x in counter:
        target = s - x
        if x < target:
            ans += counter[x] * counter.get(target, 0)
        elif x == target:
            ans += counter[x] * (counter[x] - 1) // 2
    print(ans)

if __name__ == "__main__":
    main()
0