結果

問題 No.930 数列圧縮
ユーザー kappybarkappybar
提出日時 2020-08-10 18:32:24
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,046 bytes
コンパイル時間 1,645 ms
コンパイル使用メモリ 165,932 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-16 22:52:24
合計ジャッジ時間 6,676 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 2 ms
5,376 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 17 ms
5,376 KB
testcase_14 AC 20 ms
5,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    vector<int> ans;
    vector<int> b;
    int id = 1;
    if(a[0] < a[1]){
        while(a[0] < a[id]){
            ans.push_back(a[id]);
            ++id;
            if(id==n) break;
        }
    }else{
        cout << "No" << endl;
        return 0;
    }
    for(int i=id;i<n-1;i++){
        if(a[i] > a[i+1]) b.push_back(a[i]);
        else ans.push_back(a[i]);
    }
    b.push_back(a[n-1]);

    for(int i:b){
        if(a[0] < i) ans.push_back(i);
        else{
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    for(int i:ans) cout << i <<  " " ;
    cout << endl;
    return 0;
}
0