結果
問題 |
No.3048 Swing
|
ユーザー |
|
提出日時 | 2025-04-03 09:43:44 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 538 bytes |
コンパイル時間 | 502 ms |
コンパイル使用メモリ | 82,572 KB |
実行使用メモリ | 54,436 KB |
最終ジャッジ日時 | 2025-04-03 09:43:49 |
合計ジャッジ時間 | 5,100 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 59 |
ソースコード
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 print(l) 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)