結果

問題 No.3715 Tomorrow is MONDAY!!!!!!
コンテスト
ユーザー kazuppa
提出日時 2026-09-18 20:51:13
言語 C++23
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 177 ms / 2,000 ms
+ 772µs
コード長 378 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,107 ms
コンパイル使用メモリ 333,256 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2026-09-18 20:51:42
合計ジャッジ時間 7,280 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

int main(){
  int k;ll n;cin>>k>>n;
  vector<ll> d(k);
  ll l=0,s=0;
  for(ll &i:d)cin>>i,s+=i;
  for(int i=0;i<k;i++){
    ll ans=1e18;
    if(i&&i<=(l-1)/n*n)ans=min(ans,l%n+n*(l%n==0));
    if(i!=k-1&&k-i<=s-(l+d[i]+n-1)/n*n)ans=min(ans,n-(l+d[i]-1)%n);
    cout<<(ans==1e18?-1:ans)<<endl;
    l+=d[i];
  }
}
0