結果

問題 No.3389 k-Days Later
コンテスト
ユーザー titia
提出日時 2025-12-14 01:56:48
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 645 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,793 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 21,568 KB
最終ジャッジ日時 2025-12-14 01:57:23
合計ジャッジ時間 27,273 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 6 WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
input = sys.stdin.readline

from bisect import bisect

N=int(input())
D=list(map(int,input().split()))

S=[0]
for d in D:
    S.append(S[-1]+d)

Q=int(input())

for tests in range(Q):
    y,m,d,k=map(int,input().split())

    now=y*S[-1]+S[m-1]+d
    now+=k

    #print(now)

    y=now//S[-1]
    now%=S[-1]

    if now==0:
        print(y-1,1,1)
        continue

    x=bisect(S,now)

    if now==S[x-1]:
        m=x-1
        d=now-S[m-1]

        #print(now,S[m-1],y,m,d)

        if m==0:
            y-=1
            m=N

        print(y,m,d)
    else:
        m=x
        d=now-S[m-1]

        print("!",y,m,d)

    
    

    
0