結果

問題 No.3280 Black-Tailed Gull vs Monster
ユーザー hirayuu_yc
提出日時 2025-10-04 10:53:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 848 bytes
コンパイル時間 391 ms
コンパイル使用メモリ 82,692 KB
実行使用メモリ 107,400 KB
最終ジャッジ日時 2025-10-04 10:53:11
合計ジャッジ時間 6,119 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

def main():
    it = iter(sys.stdin.buffer.read().split())
    try:
        N = int(next(it))
    except StopIteration:
        return
    X = int(next(it))
    Q = int(next(it))

    ans = 0.0
    for _ in range(Q):
        m = int(next(it))
        seen = set()
        repeated = False
        x_present = False
        for _ in range(m):
            a = int(next(it))
            if a == X:
                x_present = True
            if a in seen:
                repeated = True
            else:
                seen.add(a)
        if x_present:
            ans += 1.0
        elif repeated:
            ans += 0.5
        # else add 0.0

    # Print with enough precision
    print("{:.10f}".format(ans).rstrip('0').rstrip('.') if abs(ans - round(ans)) > 1e-12 else str(int(round(ans))))

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