結果

問題 No.2092 Conjugation
ユーザー 佐藤竜也佐藤竜也
提出日時 2023-04-07 12:29:37
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 1,920 bytes
コンパイル時間 1,408 ms
コンパイル使用メモリ 166,204 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-10 16:12:35
合計ジャッジ時間 3,350 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 11 ms
5,376 KB
testcase_08 AC 27 ms
5,376 KB
testcase_09 AC 18 ms
5,376 KB
testcase_10 AC 21 ms
5,376 KB
testcase_11 AC 21 ms
5,376 KB
testcase_12 AC 18 ms
5,376 KB
testcase_13 AC 13 ms
5,376 KB
testcase_14 AC 11 ms
5,376 KB
testcase_15 AC 17 ms
5,376 KB
testcase_16 AC 38 ms
5,376 KB
testcase_17 AC 44 ms
5,376 KB
testcase_18 AC 38 ms
5,376 KB
testcase_19 AC 13 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define rep2(i, n, s) for (int i = (n - 1); i >= (s); i--)
#define all(a)  (a).begin(),(a).end()
#define all_c(a, b) (a).begin(), (a).end(), back_inserter((b))
vector<int> dy = {-1, 0, 1, 0, -1, -1, 1, 1};
vector<int> dx = {0, 1, 0, -1, -1, 1, 1, -1};
const ll INF = numeric_limits<long long>::max();
const ll MOD = 1'000'000'007;
ll unused = INF % MOD;

ll gcd(ll A, ll B) {
    if (B == 0) return A;
    return gcd(B, A % B);
}

ll lcm(ll A, ll B) {
    ll g = gcd(A, B);
    return A / g * B;
}



// 二分検索の雛型
bool binary_search(int N, int A[], int K) {
    int left = 0, right = N - 1;
    while (left <= right) {
        int mid = (left + right) / 2;
        if (A[mid] == K) return true;
        if (A[mid] < K) left = mid + 1;
        else right = mid - 1;
    }
    return false;
}

/*
lower_bound -> if (A[mid] < K)
upper_bound -> if (A[mid] <= K)
*/
int binary_search2(int N, ll A[], ll K) {
    int left = 0, right = N;
    while (left < right) {
        int mid = (left + right) / 2;
        if (A[mid] < K) left = mid + 1;
        else right = mid;
    }
    return right;
}

/* メモ帳
・小数点以下表示 / cout << fixed << setprecision(12) << 
・ルートの計算   / sqrt(A)

・順列全列挙
    do {
        
    } while (next_permutation(V.begin() V.end()));

・bit検索
for (int i = 0; i < (1 << N); i++) {
    rep(j, 0, N) {
        int wari = (1 << j);
        if ((i / wari) % 2 == 1) {
            
        }
    }
}
*/

int N, A[100009], a, n = 0;

int main() {
    cin >> N;
    rep(i, 1, N + 2) A[i] = 0;
    A[1] = N;
    rep(i, 0, N) {
        cin >> a;
        n = max(n, a);
        A[a + 1]--;
    }
    
    rep(i, 1, n + 1) {
        A[i] += A[i - 1];
        if (i != 1) cout << " ";
        cout << A[i];
    }
    cout << endl;
}
0