結果

問題 No.318 学学学学学
ユーザー btkbtk
提出日時 2015-12-11 19:29:29
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 157 ms / 2,000 ms
コード長 542 bytes
コンパイル時間 1,748 ms
コンパイル使用メモリ 157,072 KB
実行使用メモリ 8,720 KB
最終ジャッジ日時 2023-09-04 17:34:35
合計ジャッジ時間 5,435 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
4,376 KB
testcase_01 AC 20 ms
4,384 KB
testcase_02 AC 24 ms
4,664 KB
testcase_03 AC 17 ms
4,380 KB
testcase_04 AC 22 ms
4,380 KB
testcase_05 AC 157 ms
8,572 KB
testcase_06 AC 111 ms
6,388 KB
testcase_07 AC 98 ms
5,668 KB
testcase_08 AC 86 ms
4,848 KB
testcase_09 AC 76 ms
4,376 KB
testcase_10 AC 63 ms
4,376 KB
testcase_11 AC 154 ms
8,720 KB
testcase_12 AC 102 ms
6,028 KB
testcase_13 AC 83 ms
4,884 KB
testcase_14 AC 70 ms
4,600 KB
testcase_15 AC 60 ms
4,380 KB
testcase_16 AC 51 ms
4,380 KB
testcase_17 AC 71 ms
6,340 KB
testcase_18 AC 64 ms
6,196 KB
testcase_19 AC 67 ms
6,644 KB
testcase_20 AC 34 ms
4,380 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

typedef pair<int, int> P;

int main() {
    int n;cin>>n;
    map<int,int> lr;
    vector<int> unko(n,-1);
    for(int i = 0; i < n; i++){
        int num;cin>>num;
        if(lr.count(num)==0)unko[i]=num;
        lr[num]=i;
    }
    priority_queue<P> que;
    for(int i=0;i<n;i++){
        if(unko[i]>=1){
            que.push(make_pair(unko[i],lr[unko[i]]));
        }
        while(que.top().second<i)que.pop();
        cout<<(!i)+" "<<que.top().first;
    }
    cout<<endl;
    return 0;
}
0