結果

問題 No.3389 k-Days Later
コンテスト
ユーザー t98slider
提出日時 2025-11-28 21:28:24
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 670 bytes
コンパイル時間 2,059 ms
コンパイル使用メモリ 197,952 KB
実行使用メモリ 7,852 KB
最終ジャッジ日時 2025-11-28 21:28:32
合計ジャッジ時間 8,199 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 6 WA * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    vector<ll> a(n), sv(n + 1);
    for(int i = 0; i < n; i++){
        cin >> a[i];
        sv[i + 1] = sv[i] + a[i];
    }
    int Q;
    cin >> Q;
    while(Q--){
        ll y, m, d, k, c;
        cin >> y >> m >> d >> k;
        m--, d--;
        c = y * sv[n] + sv[m] + d + k;
        ll y2 = c / sv[n];
        c -= y2 * sv[n];
        ll m2 = (upper_bound(sv.begin(), sv.end(), c) - sv.begin()) - 1;
        ll d2 = c - sv[m2];
        m2++, d2++;
        cout << y2 << ' ' << m2 << ' ' << d2 << '\n';
    }
}
0