結果
| 問題 | No.1707 Simple Range Reverse Problem |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-10-15 21:29:18 |
| 言語 | D (dmd 2.112.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 711 bytes |
| 記録 | |
| コンパイル時間 | 687 ms |
| コンパイル使用メモリ | 101,352 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2026-03-06 18:25:22 |
| 合計ジャッジ時間 | 921 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 7 WA * 12 |
ソースコード
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;
immutable long MOD = 998244353;
void solve() {
auto N = readln.chomp.to!int;
auto A = readln.split.map!(to!int).array;
auto cnt = new int[](N);
A[] -= 1;
foreach (a; A) cnt[a] += 1;
if (cnt.any!(a => a !=2)) {
writeln("No");
return;
}
if (A.front != 0) {
writeln("No");
return;
}
if (A.back != N-1) {
writeln("No");
return;
}
writeln("Yes");
}
void main() {
auto T = readln.chomp.to!int;
while (T--) {
solve;
}
}