結果

問題 No.2959 Dolls' Tea Party
ユーザー ecottea
提出日時 2024-10-26 15:01:46
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 665 bytes
コンパイル時間 84 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-10-29 00:10:09
合計ジャッジ時間 2,537 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 4
other WA * 4 RE * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

import re
import sys

content = input()
pattern = r'^(\d+) (\d+)$'
result = re.match(pattern, content)

if not result:
    sys.exit("format error.")

N, K = map(int, content.split())

if not (1 <= N and N <= 10**5):
    sys.exit("N")

if not (2 <= K and K <= 100):
    sys.exit("K")


content = input()
pattern = r'^(-?\d+)( (-?\d+))*$'
result = re.match(pattern, content)

if not result:
    sys.exit("format error.")

A = list(map(int, content.split()))

if len(A) != N:
    sys.exit("A")

sum = 0

for i in range(N):
    if not (1 <= A[i] and A[i] <= 10**5):
        sys.exit("A[i]")
    
    sum += A[i]

if not (K <= sum and sum <= 10**5):
    sys.exit("sum")
0