結果

問題 No.930 数列圧縮
ユーザー polylogKpolylogK
提出日時 2019-11-23 19:48:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,007 bytes
コンパイル時間 1,795 ms
コンパイル使用メモリ 174,168 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-19 14:44:42
合計ジャッジ時間 3,952 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::cerr;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int n; scanf("%d", &n); std::vector<int> a(n);
	for(int i = 0; i < n; i++) scanf("%d", &a[i]);

	// prepare
	std::vector<std::pair<int, int>> vec;
	for(int i = 0; i < n; i++) vec.push_back({a[i], i});
	sort(begin(vec), end(vec)); reverse(begin(vec), end(vec));

	// solve
	if(a.back() == 1) {
		printf("No\n");
		return 0;
	}

	int bound = a.back();
	std::vector<int> ans;
	for(int i = n; i > bound; i--) ans.push_back(i);
	for(int i = n - 1; i >= 0; i--) {
		if(a[i] >= bound) continue;

		ans.push_back(a[i]);
	}
	
	printf("Yes\n");
	for(auto v: ans) printf("%d ", v);
	printf("\n");
	return 0;
}
0