結果

問題 No.3389 k-Days Later
コンテスト
ユーザー yt142857
提出日時 2025-11-21 10:25:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 452 bytes
コンパイル時間 527 ms
コンパイル使用メモリ 82,768 KB
実行使用メモリ 91,988 KB
最終ジャッジ日時 2025-11-28 20:58:16
合計ジャッジ時間 20,590 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 22 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import bisect
n = int(input())
s = [int(_) for _ in input().split()]
year = sum(s)
rui = [0]
for i in s:
	rui.append(rui[-1]+i)
q = int(input())
def n_to_d(a):
  nibu = bisect.bisect_left(rui,a)
  return (nibu,a-rui[nibu-1])
def d_to_n(a):
  a,b = a[0],a[1]
  return rui[a-1]+b
for _ in range(q):
	a,b,c,d = map(int,input().split())
	a += d//year
	d = d%year
	num = d_to_n((b,c))+d
	if num>=year:
	  num-=year
	  a += 1
	b,c = n_to_d(num)
	print(a,b,c)
0