結果
| 問題 | No.930 数列圧縮 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-11-22 21:49:21 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 976 bytes |
| 記録 | |
| コンパイル時間 | 733 ms |
| コンパイル使用メモリ | 118,900 KB |
| 実行使用メモリ | 11,572 KB |
| 最終ジャッジ日時 | 2024-06-22 03:03:20 |
| 合計ジャッジ時間 | 4,243 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 WA * 18 |
ソースコード
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;
void main() {
auto N = readln.chomp.to!int;
auto A = readln.split.map!(to!int).array;
int[][] B;
int tmp = 1 << 29;
foreach (a; A) {
if (a > tmp) {
B.back ~= a;
tmp = a;
} else {
B ~= [a];
tmp = a;
}
}
if (B.length > 1 && B[0..$-1].map!(b => b.front > B.back.back).any) {
writeln("No");
return;
}
writeln("Yes");
int[] ans;
foreach (i; 0..B.length.to!int-1) {
foreach (j; 1..B[i].length) {
write(B[i][j], " ");
}
}
foreach_reverse (i; 0..B.back.length.to!int-1) {
write(B.back[i], " ");
}
foreach_reverse (i; 0..B.length.to!int-1) {
write(B[i].front, " ");
}
writeln;
}