結果

問題 No.930 数列圧縮
ユーザー chocoruskchocorusk
提出日時 2019-11-21 23:36:40
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 42 ms / 2,000 ms
コード長 990 bytes
コンパイル時間 1,113 ms
コンパイル使用メモリ 108,532 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-19 10:06:01
合計ジャッジ時間 3,921 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n;
	cin>>n;
	assert(2<=n && n<=100000);
	int a[100010];
	bool used[100010]={};
	for(int i=0; i<n; i++){
		cin>>a[i];
		assert(1<=a[i] && a[i]<=n);
		assert(!used[a[i]]);
		used[a[i]]=1;
	}
	if(a[0]>a[n-1]){
		cout<<"No"<<endl;
		return 0;
	}
	cout<<"Yes"<<endl;
	for(int i=1; i<n-1; i++){
		if(a[i]>a[0]) cout<<a[i]<<" ";
	}
	for(int i=n-2; i>0; i--){
		if(a[i]<a[0]) cout<<a[i]<<" ";
	}
	cout<<a[0]<<" ";
	cout<<endl;
	return 0;
}
0