結果

問題 No.318 学学学学学
ユーザー mamekinmamekin
提出日時 2015-12-20 10:02:05
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 62 ms / 2,000 ms
コード長 1,128 bytes
コンパイル時間 1,039 ms
コンパイル使用メモリ 97,616 KB
実行使用メモリ 4,892 KB
最終ジャッジ日時 2023-09-04 18:23:44
合計ジャッジ時間 4,272 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
4,380 KB
testcase_01 AC 11 ms
4,380 KB
testcase_02 AC 13 ms
4,376 KB
testcase_03 AC 10 ms
4,384 KB
testcase_04 AC 12 ms
4,380 KB
testcase_05 AC 59 ms
4,688 KB
testcase_06 AC 59 ms
4,788 KB
testcase_07 AC 60 ms
4,892 KB
testcase_08 AC 61 ms
4,584 KB
testcase_09 AC 61 ms
4,736 KB
testcase_10 AC 62 ms
4,700 KB
testcase_11 AC 59 ms
4,576 KB
testcase_12 AC 60 ms
4,696 KB
testcase_13 AC 60 ms
4,572 KB
testcase_14 AC 60 ms
4,572 KB
testcase_15 AC 59 ms
4,620 KB
testcase_16 AC 55 ms
4,636 KB
testcase_17 AC 49 ms
4,760 KB
testcase_18 AC 42 ms
4,736 KB
testcase_19 AC 49 ms
4,640 KB
testcase_20 AC 40 ms
4,628 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 2 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 1 ms
4,376 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    vector<pair<int, int> > p(n);
    for(int i=0; i<n; ++i){
        cin >> a[i];
        p[i] = make_pair(a[i], i);
    }
    sort(p.rbegin(), p.rend());

    vector<int> skip(n, -1);
    for(int i=0; i<n-1; ++i){
        int b = p[i].first;
        int x = p[i].second;
        int y = p[i].second;
        if(b == p[i+1].first)
            x = p[i+1].second;

        for(int i=x; i<=y; ++i){
            if(skip[i] == -1){
                a[i] = b;
                skip[i] = y;
            }
            else{
                i = skip[i];
            }
        }
    }

    cout << a[0];
    for(int i=1; i<n; ++i)
        cout << ' ' << a[i];
    cout << endl;

    return 0;
}
0