結果

問題 No.1375 Divide and Update
ユーザー LayCurseLayCurse
提出日時 2023-02-27 21:41:24
言語 cLay
(20240104-1)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 368 bytes
コンパイル時間 2,311 ms
コンパイル使用メモリ 163,968 KB
実行使用メモリ 10,144 KB
最終ジャッジ日時 2023-10-13 06:15:07
合計ジャッジ時間 6,631 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 1 ms
4,368 KB
testcase_02 AC 2 ms
4,368 KB
testcase_03 AC 2 ms
4,372 KB
testcase_04 AC 1 ms
4,372 KB
testcase_05 AC 1 ms
4,372 KB
testcase_06 AC 2 ms
4,372 KB
testcase_07 AC 1 ms
4,368 KB
testcase_08 AC 2 ms
4,372 KB
testcase_09 AC 2 ms
4,372 KB
testcase_10 AC 20 ms
9,656 KB
testcase_11 AC 19 ms
9,280 KB
testcase_12 AC 11 ms
7,248 KB
testcase_13 AC 9 ms
6,736 KB
testcase_14 AC 22 ms
10,144 KB
testcase_15 AC 22 ms
10,048 KB
testcase_16 AC 21 ms
10,092 KB
testcase_17 AC 21 ms
10,092 KB
testcase_18 AC 21 ms
10,100 KB
testcase_19 AC 21 ms
10,104 KB
testcase_20 AC 17 ms
9,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

void solve(int N, ll X, ll A[], ll res[]){
  ll s = 0;
  rep(i,N+1) res[i] = -ll_inf;
  rep(i,N){
    s += X - A[i];
    res[i+1] >?= s;
    s >?= 0;
  }
  rep(i,N) res[i+1] >?= res[i];
}
{
  int @N; ll @X, @Y, @A[N];
  ll ans1[N+1], ans2[N+1], s = sum(A(N));
  solve(N,X,A,ans1);
  reverse(A,A+N);
  solve(N,Y,A,ans2);
  rep(i,1,N-1) wt(s + ans1[i] + ans2[N-1-i]);
}
0