結果

問題 No.610 区間賞(Section Award)
ユーザー nanaenanae
提出日時 2017-12-10 00:23:28
言語 D
(dmd 2.107.1)
結果
AC  
実行時間 90 ms / 2,000 ms
コード長 1,049 bytes
コンパイル時間 3,631 ms
コンパイル使用メモリ 155,116 KB
実行使用メモリ 13,108 KB
最終ジャッジ日時 2023-09-03 17:24:41
合計ジャッジ時間 6,242 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 13 ms
4,520 KB
testcase_20 AC 66 ms
11,116 KB
testcase_21 AC 9 ms
4,376 KB
testcase_22 AC 46 ms
10,100 KB
testcase_23 AC 6 ms
4,380 KB
testcase_24 AC 16 ms
6,860 KB
testcase_25 AC 4 ms
4,380 KB
testcase_26 AC 30 ms
7,944 KB
testcase_27 AC 67 ms
11,836 KB
testcase_28 AC 60 ms
10,712 KB
testcase_29 AC 41 ms
8,640 KB
testcase_30 AC 54 ms
9,648 KB
testcase_31 AC 28 ms
8,112 KB
testcase_32 AC 62 ms
12,104 KB
testcase_33 AC 9 ms
4,380 KB
testcase_34 AC 66 ms
10,904 KB
testcase_35 AC 31 ms
7,068 KB
testcase_36 AC 64 ms
10,804 KB
testcase_37 AC 52 ms
10,744 KB
testcase_38 AC 15 ms
6,192 KB
testcase_39 AC 70 ms
11,108 KB
testcase_40 AC 69 ms
10,792 KB
testcase_41 AC 70 ms
11,744 KB
testcase_42 AC 71 ms
12,224 KB
testcase_43 AC 72 ms
12,036 KB
testcase_44 AC 73 ms
13,108 KB
testcase_45 AC 90 ms
10,900 KB
testcase_46 AC 90 ms
10,896 KB
testcase_47 AC 59 ms
11,744 KB
testcase_48 AC 57 ms
9,556 KB
testcase_49 AC 59 ms
10,724 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio, std.string, std.conv, std.algorithm, std.numeric;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;


void main() {
    int n;
    scan(n);

    auto a = readln.split.to!(int[]);
    auto b = readln.split.to!(int[]);

    auto ar = new int[](n + 1);
    foreach (i ; 0 .. n) {
        ar[a[i]] = i;
    }

    auto set = redBlackTree!(int)();
    auto aw = new bool[](n + 1);

    foreach (i ; 0 .. n) {
        set.insert(ar[b[i]]);

        if (set.upperBound(ar[b[i]]).empty) {
            aw[b[i]] = true;
        }
    }

    foreach (i ; 1 .. n + 1) {
        if (aw[i]) writeln(i);
    }
}



void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}



void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}
0