結果
| 問題 | No.115 遠足のおやつ |
| コンテスト | |
| ユーザー |
JunOnuma
|
| 提出日時 | 2017-06-16 13:09:33 |
| 言語 | PyPy2 (7.3.20) |
| 結果 |
AC
|
| 実行時間 | 52 ms / 5,000 ms |
| + 649µs | |
| コード長 | 497 bytes |
| 記録 | |
| コンパイル時間 | 58 ms |
| コンパイル使用メモリ | 81,392 KB |
| 実行使用メモリ | 81,280 KB |
| 最終ジャッジ日時 | 2026-07-18 14:48:55 |
| 合計ジャッジ時間 | 4,333 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 40 |
ソースコード
def func(s,e,k,t):
if s > t or (s+e)*(e-s+1)/2 < t or (e + e - k + 1) * k / 2 < t:
return []
if k == 1:
if s <= t and t <= e:
return [t]
else:
return []
for i in range(s,e+1):
l = func(i+1,e,k-1,t-i)
if l != []:
l.append(i)
return l
else:
return []
n,d,k = map(int, raw_input().split())
l = func(1,n,k,d)
if l == []:
print -1
else:
l.reverse()
print ' '.join(map(str, l))
JunOnuma