結果

問題 No.318 学学学学学
ユーザー 🍮かんプリン
提出日時 2020-05-26 23:14:13
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 141 ms / 2,000 ms
コード長 517 bytes
コンパイル時間 2,402 ms
コンパイル使用メモリ 170,708 KB
実行使用メモリ 8,320 KB
最終ジャッジ日時 2024-10-13 03:08:27
合計ジャッジ時間 6,882 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2020.05.26 23:14:06
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;

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