結果

問題 No.318 学学学学学
ユーザー imulanimulan
提出日時 2016-09-29 02:11:12
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 114 ms / 2,000 ms
コード長 761 bytes
コンパイル時間 2,016 ms
コンパイル使用メモリ 178,784 KB
実行使用メモリ 8,248 KB
最終ジャッジ日時 2023-09-04 20:30:58
合計ジャッジ時間 5,250 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
4,380 KB
testcase_01 AC 15 ms
4,568 KB
testcase_02 AC 18 ms
4,528 KB
testcase_03 AC 12 ms
4,384 KB
testcase_04 AC 16 ms
4,504 KB
testcase_05 AC 107 ms
8,204 KB
testcase_06 AC 114 ms
7,072 KB
testcase_07 AC 98 ms
6,328 KB
testcase_08 AC 83 ms
5,432 KB
testcase_09 AC 68 ms
4,508 KB
testcase_10 AC 46 ms
4,380 KB
testcase_11 AC 110 ms
8,248 KB
testcase_12 AC 71 ms
5,752 KB
testcase_13 AC 58 ms
5,236 KB
testcase_14 AC 47 ms
4,548 KB
testcase_15 AC 39 ms
4,380 KB
testcase_16 AC 28 ms
4,384 KB
testcase_17 AC 69 ms
8,156 KB
testcase_18 AC 47 ms
5,900 KB
testcase_19 AC 70 ms
8,248 KB
testcase_20 AC 27 ms
4,388 KB
testcase_21 AC 1 ms
4,384 KB
testcase_22 AC 1 ms
4,384 KB
testcase_23 AC 2 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,380 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

int main()
{
    int n;
    scanf(" %d", &n);
    vector<int> a(n);
    rep(i,n) scanf(" %d", &a[i]);

    map<int,int> most_right;
    for(int i=n-1; i>=0; --i)
    {
        if(most_right.find(a[i]) == most_right.end()) most_right[a[i]]=i;
    }

    set<int> s;

    rep(i,n)
    {
        s.insert(a[i]);

        if(i) printf(" ");
        printf("%d", *s.rbegin());

        if(i == most_right[a[i]]) s.erase(a[i]);
    }
    printf("\n");
    
    return 0;
}
0