提出 #61570361


ソースコード 拡げる

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

int main() {
  int n; cin >> n;
  vector<int> a(n), b(n+5);
  int hav = 0;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    hav += b[i];
    a[i] += hav;
    hav++;
    b[min(n+1,i+a[i]+1)]--;
  }
  for (int i = 0; i < n; i++) {
    a[i] = max(0, a[i] - (n - 1 - i));
    cout << a[i] << " ";
  }
  cout << endl;
}

提出情報

提出日時
問題 D - Coming of Age Celebration
ユーザ harady
言語 C++ 20 (gcc 12.2)
得点 400
コード長 409 Byte
結果 AC
実行時間 117 ms
メモリ 7820 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 400 / 400
結果
AC × 3
AC × 23
セット名 テストケース
Sample sample00.txt, sample01.txt, sample02.txt
All sample00.txt, sample01.txt, sample02.txt, testcase00.txt, testcase01.txt, testcase02.txt, testcase03.txt, testcase04.txt, testcase05.txt, testcase06.txt, testcase07.txt, testcase08.txt, testcase09.txt, testcase10.txt, testcase11.txt, testcase12.txt, testcase13.txt, testcase14.txt, testcase15.txt, testcase16.txt, testcase17.txt, testcase18.txt, testcase19.txt
ケース名 結果 実行時間 メモリ
sample00.txt AC 1 ms 3648 KiB
sample01.txt AC 1 ms 3456 KiB
sample02.txt AC 1 ms 3464 KiB
testcase00.txt AC 1 ms 3652 KiB
testcase01.txt AC 72 ms 7020 KiB
testcase02.txt AC 117 ms 7820 KiB
testcase03.txt AC 98 ms 6300 KiB
testcase04.txt AC 116 ms 7052 KiB
testcase05.txt AC 32 ms 4320 KiB
testcase06.txt AC 116 ms 7124 KiB
testcase07.txt AC 94 ms 6236 KiB
testcase08.txt AC 116 ms 7056 KiB
testcase09.txt AC 98 ms 6288 KiB
testcase10.txt AC 116 ms 7052 KiB
testcase11.txt AC 47 ms 4704 KiB
testcase12.txt AC 117 ms 7072 KiB
testcase13.txt AC 74 ms 5536 KiB
testcase14.txt AC 116 ms 7096 KiB
testcase15.txt AC 14 ms 3688 KiB
testcase16.txt AC 116 ms 7104 KiB
testcase17.txt AC 97 ms 6320 KiB
testcase18.txt AC 79 ms 6796 KiB
testcase19.txt AC 67 ms 6808 KiB