結果

問題 No.1707 Simple Range Reverse Problem
コンテスト
ユーザー nebukuro09
提出日時 2021-10-15 21:29:18
言語 D
(dmd 2.112.0)
コンパイル:
dmd -fPIE -m64 -w -wi -O -release -inline -I/opt/dmd/src/druntime/import/ -I/opt/dmd/src/phobos -L-L/opt/dmd/linux/lib64/ -fPIC _filename_
実行:
./Main
結果
WA  
実行時間 -
コード長 711 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 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
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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;
    }
}
0