結果

問題 No.930 数列圧縮
ユーザー mmn15277198mmn15277198
提出日時 2020-11-28 09:51:44
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 928 bytes
コンパイル時間 915 ms
コンパイル使用メモリ 95,508 KB
実行使用メモリ 4,480 KB
最終ジャッジ日時 2023-10-09 23:40:42
合計ジャッジ時間 6,068 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>

using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll inf = 1e9 + 7;

int main(){	
	cin.tie(0);
	ios::sync_with_stdio(false);
	//cout << fixed << setprecison(15);
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	vector<int> ans;
	vector<int> s;
	for(int i = 0; i < n - 1; i++){
		if(i == 0){
			s.push_back(a[i]);
		}else{
			if(s.back() > a[i]){
				s.push_back(a[i]);
			}else{
				ans.push_back(i + 1);
			}
		}
	}
	for(int i = s.size() - 1; i >= 0; i--){
		if(a[n - 1] > s[i]){
			ans.push_back(i + 1);
		}else{
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	for(int i = 0; i < ans.size(); i++){
		cout << ans[i] << " ";
	}
	cout << endl;
	return 0;
}
 
 
0