結果
| 問題 |
No.2027 (1, 2, 3, …, N) 's Subset Sum
|
| ユーザー |
hiraku
|
| 提出日時 | 2022-08-05 21:30:06 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 93 ms / 2,000 ms |
| コード長 | 312 bytes |
| コンパイル時間 | 193 ms |
| コンパイル使用メモリ | 81,920 KB |
| 実行使用メモリ | 98,944 KB |
| 最終ジャッジ日時 | 2024-09-15 17:40:58 |
| 合計ジャッジ時間 | 3,836 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 25 |
ソースコード
n, s = map(int, input().split())
if s > (1 + n) * n // 2:
print(-1)
else:
nouse = set()
r = (1 + n) * n // 2 - s
for i in range(n, 0, -1):
if i <= r:
nouse.add(i)
r -= i
ans = [i for i in range(1, n + 1) if i not in nouse]
print(len(ans))
print(*ans)
hiraku