結果

問題 No.318 学学学学学
ユーザー kuc_jacksonkuc_jackson
提出日時 2021-09-04 18:16:06
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 740 bytes
コンパイル時間 2,203 ms
コンパイル使用メモリ 210,940 KB
実行使用メモリ 11,456 KB
最終ジャッジ日時 2023-08-23 07:31:31
合計ジャッジ時間 17,299 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
4,380 KB
testcase_01 AC 23 ms
4,700 KB
testcase_02 AC 28 ms
4,796 KB
testcase_03 AC 18 ms
4,380 KB
testcase_04 AC 25 ms
4,832 KB
testcase_05 AC 181 ms
10,116 KB
testcase_06 TLE -
testcase_07 TLE -
testcase_08 AC 1,892 ms
5,204 KB
testcase_09 AC 1,181 ms
4,380 KB
testcase_10 AC 216 ms
4,376 KB
testcase_11 AC 182 ms
10,164 KB
testcase_12 AC 124 ms
6,996 KB
testcase_13 AC 105 ms
5,892 KB
testcase_14 AC 88 ms
5,092 KB
testcase_15 AC 72 ms
4,380 KB
testcase_16 AC 55 ms
4,380 KB
testcase_17 TLE -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    const int INF = 1e9;
    int N; cin >> N;
    vector<int> a(N);
    map<int, pii> cnt;
    for(int i = 0; i < N; i++){
        cin >> a[i];
        cnt[-a[i]] = {INF, -INF};
    }
    for(int i = 0; i < N; i++){
        cnt[-a[i]].first = min(cnt[-a[i]].first, i);
        cnt[-a[i]].second = max(cnt[-a[i]].second, i);
    }
    vector<int> ans(N, -1);
    for(auto mp: cnt){
        int x; pii p; tie(x, p) = mp; x *= -1;
        int l, r; tie(l, r) = p;
        for(int i = l; i <= r; i++){
            if(ans[i] != -1)continue;
            ans[i] = x;
        }
    }
    for(int x: ans)cout << x << " ";
    cout << endl;
}
0