結果
| 問題 | No.120 傾向と対策:門松列(その1) | 
| コンテスト | |
| ユーザー |  diginatu | 
| 提出日時 | 2015-01-09 01:06:40 | 
| 言語 | D (dmd 2.109.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 42 ms / 5,000 ms | 
| コード長 | 574 bytes | 
| コンパイル時間 | 2,076 ms | 
| コンパイル使用メモリ | 165,600 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-12 01:59:46 | 
| 合計ジャッジ時間 | 2,799 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 4 | 
ソースコード
import std.stdio, std.conv, std.math, std.string, std.range, std.array,
       std.algorithm;
void main(){
  auto T = readln().strip().to!int();
  foreach(immutable i; 0 .. T) {
    auto N = readln().strip().to!int();
    auto L = readln().strip().split().map!(to!int)().array;
    L.sort();
    auto tps = L.group().map!"a[1]"().array();
    if(tps.length < 3) {
      writeln(0);
      continue;
    }
    int ans;
    for(;;) {
      tps.topN!"a > b"(3);
      if(tps[0 .. 3].any!"a == 0"()) break;
      -- tps[0 .. 3];
      ++ ans;
    }
    writeln(ans);
  }
}
            
            
            
        