結果
| 問題 |
No.115 遠足のおやつ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-09-15 20:56:45 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 331 bytes |
| コンパイル時間 | 240 ms |
| コンパイル使用メモリ | 82,156 KB |
| 実行使用メモリ | 89,260 KB |
| 最終ジャッジ日時 | 2024-06-22 01:55:52 |
| 合計ジャッジ時間 | 7,234 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 3 |
| other | AC * 4 TLE * 1 -- * 35 |
ソースコード
import itertools
n, d, k = map(int,input().split())
if d < k*(k+1)//2 or d > n*(n+1)//2:
print(-1)
exit()
nums = [i for i in range(1,n+1)]
ans = []
for ll in itertools.combinations(nums, k):
tmp = 0
for l in ll:
tmp += l
if tmp == d:
ans.append(sorted(ll))
ans.sort()
print(*ans[0])