結果

問題 No.318 学学学学学
ユーザー lowrlowr
提出日時 2019-09-26 19:34:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 143 ms / 2,000 ms
コード長 453 bytes
コンパイル時間 2,311 ms
コンパイル使用メモリ 215,356 KB
実行使用メモリ 8,356 KB
最終ジャッジ日時 2023-10-24 15:40:08
合計ジャッジ時間 5,931 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
4,348 KB
testcase_01 AC 19 ms
4,548 KB
testcase_02 AC 22 ms
4,724 KB
testcase_03 AC 15 ms
4,376 KB
testcase_04 AC 18 ms
4,596 KB
testcase_05 AC 142 ms
8,356 KB
testcase_06 AC 143 ms
7,276 KB
testcase_07 AC 126 ms
6,484 KB
testcase_08 AC 109 ms
5,488 KB
testcase_09 AC 93 ms
4,636 KB
testcase_10 AC 71 ms
4,348 KB
testcase_11 AC 134 ms
8,356 KB
testcase_12 AC 93 ms
6,012 KB
testcase_13 AC 85 ms
5,232 KB
testcase_14 AC 72 ms
4,636 KB
testcase_15 AC 64 ms
4,348 KB
testcase_16 AC 54 ms
4,348 KB
testcase_17 AC 82 ms
8,356 KB
testcase_18 AC 67 ms
6,012 KB
testcase_19 AC 83 ms
8,356 KB
testcase_20 AC 39 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 2 ms
4,348 KB
testcase_26 AC 2 ms
4,348 KB
testcase_27 AC 2 ms
4,348 KB
testcase_28 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using i64 = long long;

int main() {
    int n;
    std::cin >> n;
    std::vector<int> a(n);
    std::map<int, int> pos;
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
        pos[a[i]] = i;
    }
    
    std::set<int> s;
    for (int i = 0; i < n; i++) {
        s.insert(a[i]);
        std::cout << *s.rbegin() << " ";
        if (pos[a[i]] == i) s.erase(a[i]);
    }
    std::cout << std::endl;
    return 0;
}
0