結果

問題 No.3750 Mischievous Resident (Easy)
コンテスト
ユーザー InTheBloom
提出日時 2026-10-02 21:45:46
言語 D
(dmd 2.113.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  
実行時間 -
コード長 852 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,613 ms
コンパイル使用メモリ 171,276 KB
実行使用メモリ 17,484 KB
最終ジャッジ日時 2026-10-02 21:46:02
合計ジャッジ時間 10,491 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 23 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import std;

void main () {
    int caseNum = readln.chomp.to!int;

    auto ans = new bool[](caseNum);
    foreach (caseId; 0 .. caseNum) {
        int N, M;
        readln.read(N, M);
        auto S = readln.split.to!(int[]);
        auto G = readln.split.to!(int[]);

        auto ord = iota(M).array;
        ord.sort!((a, b) => G[a] < G[b]);

        ans[caseId] = true;
        foreach (i; 0 .. M - 1) {
            int a = ord[i];
            int b = ord[i + 1];
            if (S[b] < S[a]) {
                ans[caseId] = false;
            }
        }
    }

    foreach (i; 0 .. caseNum) {
        writeln(ans[i] ? "Yes" : "No");
    }
}

void read (T...) (string S, ref T args) {
    import std.conv : to;
    import std.array : split;
    auto buf = S.split;
    foreach (i, ref arg; args) {
        arg = buf[i].to!(typeof(arg));
    }
}
0