結果

問題 No.318 学学学学学
ユーザー seoul_ajaeseoul_ajae
提出日時 2020-07-27 08:22:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 177 ms / 2,000 ms
コード長 469 bytes
コンパイル時間 2,551 ms
コンパイル使用メモリ 179,600 KB
実行使用メモリ 10,268 KB
最終ジャッジ日時 2023-09-11 05:40:03
合計ジャッジ時間 5,924 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
4,376 KB
testcase_01 AC 19 ms
4,528 KB
testcase_02 AC 24 ms
4,844 KB
testcase_03 AC 16 ms
4,656 KB
testcase_04 AC 20 ms
4,600 KB
testcase_05 AC 159 ms
10,220 KB
testcase_06 AC 177 ms
8,188 KB
testcase_07 AC 153 ms
7,036 KB
testcase_08 AC 121 ms
6,108 KB
testcase_09 AC 97 ms
5,108 KB
testcase_10 AC 72 ms
4,380 KB
testcase_11 AC 157 ms
10,268 KB
testcase_12 AC 106 ms
7,000 KB
testcase_13 AC 85 ms
5,868 KB
testcase_14 AC 73 ms
5,264 KB
testcase_15 AC 62 ms
4,416 KB
testcase_16 AC 52 ms
4,380 KB
testcase_17 AC 89 ms
9,592 KB
testcase_18 AC 74 ms
7,044 KB
testcase_19 AC 89 ms
9,468 KB
testcase_20 AC 37 ms
4,380 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 2 ms
4,380 KB
testcase_28 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
map<ll, ll> last;

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

    set <ll> s;
    for(int i=0; i<n; i++)
    {
        s.insert(a[i]);
        printf("%lld ", *s.rbegin());
        if(last[a[i]]==i) s.erase(a[i]);
    }
    printf("\n");

    return 0;
}
0