結果
| 問題 | No.3048 Swing |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-03 09:44:37 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 36 ms / 2,000 ms |
| + 814µs | |
| コード長 | 529 bytes |
| 記録 | |
| コンパイル時間 | 82 ms |
| コンパイル使用メモリ | 64,764 KB |
| 実行使用メモリ | 53,828 KB |
| 最終ジャッジ日時 | 2026-10-21 07:23:36 |
| 合計ジャッジ時間 | 4,946 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 63 |
ソースコード
x,n=map(int,input().split())
l,r=0,10**10
while r-l>1:
c=(l+r)//2
if x>0:
if x-c*(c+1)//2>0:
l=c
else:
r=c
else:
if x+c*(c+1)//2>0:
r=c
else:
l=c
if x<=0:
l+=1
if n<=l:
stc=n*(n+1)//2
if x>0:
print(x-stc)
else:
print(x+stc)
else:
stc=l*(l+1)//2
if x>0:
now=x-stc
else:
now=x+stc
zan=n-l
if zan%2==0:
print(now+zan//2)
else:
print(now-l-1-(zan-1)//2)