結果
| 問題 | No.2027 (1, 2, 3, …, N) 's Subset Sum |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-08-05 21:48:07 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 392 bytes |
| 記録 | |
| コンパイル時間 | 242 ms |
| コンパイル使用メモリ | 95,848 KB |
| 実行使用メモリ | 103,936 KB |
| 最終ジャッジ日時 | 2026-08-28 04:27:49 |
| 合計ジャッジ時間 | 6,457 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | WA * 25 |
ソースコード
n,s = map(int,input().split())
ans = []
for i in range(1,n+1):
if i <= s:
ans.append(i)
s -= i
else:
break
if s == 0:
print(*ans)
exit()
now = len(ans)-1
l = len(ans)
while s:
dif = n-ans[now]-(l-now-1)
if dif >= s:
ans[now] += s
print(*ans)
exit()
else:
ans[now] += dif
s -= dif
now -= 1