結果

問題 No.120 傾向と対策:門松列(その1)
ユーザー te-shte-sh
提出日時 2016-08-30 21:48:40
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 643 bytes
コンパイル時間 1,030 ms
コンパイル使用メモリ 114,024 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-09-02 21:38:15
合計ジャッジ時間 1,897 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm, std.array, std.container, std.range;
import std.string, std.conv;
import std.math, std.bigint, std.bitmanip, std.random;
import std.stdio, std.typecons;

const auto mod = 10 ^^ 9 + 7;

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

  foreach (_; 0..t) {
    auto n = readln.chomp.to!int;
    auto ai = readln.split.map!(to!int).array;

    ai.sort!("a > b");
    auto gi = ai.group.map!("a[1]").map!(to!int).array;
    writeln(calc(gi, 0));
  }
}

int calc(int[] gi, int acc)
{
  if (gi.length < 3) {
    return acc;
  } else {
    gi[0..3] -= 1;
    gi.sort!("a > b");
    return calc(gi.until(0).array, acc + 1);
  }
}
0