結果

問題 No.120 傾向と対策:門松列(その1)
ユーザー kutsutamakutsutama
提出日時 2019-01-14 01:28:51
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 654 bytes
コンパイル時間 68 ms
コンパイル使用メモリ 10,884 KB
実行使用メモリ 8,320 KB
最終ジャッジ日時 2023-08-28 15:25:24
合計ジャッジ時間 1,061 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

def solve(N, L):
    L.sort()
    used = -1
    res = 0
    for st in range(len(L)):
        prev = L[st]
        cnt = 0
        for i in range(st, len(L)):
            if L[i] == used:
                continue
            if cnt == 0 or L[i] != prev:
                cnt += 1
                prev = L[i]
                L[i] = used
            if cnt == 3:
                res += 1
                break
        if cnt < 3:
            break
    return res

T = int(input())
lis = [0] * T
for tt in range(T):
    nt = int(input())
    lt = [int(x) for x in input().split()]
    lis[tt] = solve(nt, lt)
print(*lis, sep='\n')
0