結果

問題 No.2092 Conjugation
ユーザー Carpenters-Cat
提出日時 2022-10-07 21:27:09
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 462 bytes
コンパイル時間 1,952 ms
コンパイル使用メモリ 192,908 KB
最終ジャッジ日時 2025-02-07 22:49:56
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 18
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:10: warning: ‘N’ is used uninitialized [-Wuninitialized]
    9 |     B[0] = N;
      |     ~~~~~^~~
main.cpp:4:9: note: ‘N’ was declared here
    4 |     int N;
      |         ^

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main () {
    int N;
    int B[100010];
    for (int i = 0; i < 100010; i ++) {
        B[i] = 0;
    }
    B[0] = N;
    int s = -1;
    for (int i = 0; i < N; i ++) {
        int a;
        cin >> a;
        B[a] --;
        if (s == -1) {
            s = a;
        }
    }
    for (int i = 0; i < s; i ++) {
        cout << B[i] << (i == s - 1 ? "" : " ");
        B[i + 1] += B[i];
    }
    cout << endl;
}
0