結果

問題 No.120 傾向と対策:門松列(その1)
コンテスト
ユーザー Hachimori
提出日時 2015-01-08 23:35:34
言語 PyPy2
(7.3.20)
結果
WA  
実行時間 -
コード長 666 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 130 ms
コンパイル使用メモリ 77,720 KB
最終ジャッジ日時 2025-12-03 13:28:10
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#!/usr/bin/env python


def read():
    return input(), map(int, raw_input().split())


def work((N, vList)):
    vList.sort()

    used = [False for i in range(N)]
    
    A = 0
    B = 1
    C = 2
    ans = 0
    
    while max(A, B, C) < N:
        while A < N and used[A]:
            A += 1

        while max(A, B) < N and (vList[B] <= vList[A] or used[B]):
            B += 1

        while max(A, B, C) < N and (vList[C] <= vList[B] or used[C]):
            C += 1

        if max(A, B, C) < N:
            ans += 1
            used[A] = used[B] = used[C] = True

    print ans


if __name__ == "__main__":
    for i in range(input()):
        work(read())
0