結果

問題 No.318 学学学学学
ユーザー face4face4
提出日時 2019-01-29 13:29:17
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 154 ms / 2,000 ms
コード長 458 bytes
コンパイル時間 853 ms
コンパイル使用メモリ 86,508 KB
実行使用メモリ 8,156 KB
最終ジャッジ日時 2023-09-04 21:18:35
合計ジャッジ時間 4,541 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
4,380 KB
testcase_01 AC 18 ms
4,380 KB
testcase_02 AC 22 ms
4,556 KB
testcase_03 AC 14 ms
4,380 KB
testcase_04 AC 19 ms
4,380 KB
testcase_05 AC 146 ms
7,988 KB
testcase_06 AC 154 ms
7,084 KB
testcase_07 AC 129 ms
6,112 KB
testcase_08 AC 111 ms
5,176 KB
testcase_09 AC 90 ms
4,380 KB
testcase_10 AC 69 ms
4,380 KB
testcase_11 AC 146 ms
8,120 KB
testcase_12 AC 97 ms
5,816 KB
testcase_13 AC 79 ms
4,916 KB
testcase_14 AC 68 ms
4,380 KB
testcase_15 AC 58 ms
4,376 KB
testcase_16 AC 50 ms
4,376 KB
testcase_17 AC 80 ms
8,156 KB
testcase_18 AC 66 ms
5,740 KB
testcase_19 AC 80 ms
8,036 KB
testcase_20 AC 35 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<map>
#include<vector>
#include<set>
using namespace std;

int main(){
    int n;
    cin >> n;

    vector<int> a(n);
    map<int,int> last;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        last[a[i]] = i;
    }

    set<int> appear;
    for(int i = 0; i < n; i++){
        appear.insert(a[i]);
        cout << *appear.rbegin() << " \n"[i == n-1];
        if(last[a[i]] == i) appear.erase(a[i]);
    }

    return 0;
}
0