結果

問題 No.110 しましまピラミッド
ユーザー kokatsu
提出日時 2022-10-18 00:20:43
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 599 bytes
コンパイル時間 2,522 ms
コンパイル使用メモリ 214,720 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-22 16:23:20
合計ジャッジ時間 2,856 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

void main() {
    int Nw;
    readf("%d\n", Nw);

    auto W = readln.chomp.split.to!(int[]);

    int Nb;
    readf("%d\n", Nb);

    auto B = readln.chomp.split.to!(int[]);

    auto sorted = new SortedRange!(int[], "a < b")[](2);
    sorted[0] = W.sort;
    sorted[1] = B.sort;

    int res;
    foreach (i; 0 .. 2) {
        int cnt, idx = i, len = 100;
        while (true) {
            auto lb = sorted[idx].lowerBound(len);
            if (lb.empty) break;

            ++cnt, idx = (idx + 1) % 2, len = lb.back;
        }

        res = max(res, cnt);
    }

    res.writeln;
}
0