結果

問題 No.390 最長の数列
ユーザー terasaterasa
提出日時 2022-05-28 16:19:43
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,086 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 81,836 KB
実行使用メモリ 105,072 KB
最終ジャッジ日時 2023-10-20 23:13:19
合計ジャッジ時間 4,361 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
62,060 KB
testcase_01 AC 64 ms
62,060 KB
testcase_02 WA -
testcase_03 AC 67 ms
62,060 KB
testcase_04 WA -
testcase_05 AC 97 ms
100,684 KB
testcase_06 AC 980 ms
105,072 KB
testcase_07 AC 66 ms
62,052 KB
testcase_08 AC 46 ms
55,776 KB
testcase_09 AC 60 ms
62,052 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 161 ms
97,776 KB
testcase_14 WA -
testcase_15 AC 46 ms
55,776 KB
testcase_16 AC 46 ms
55,776 KB
testcase_17 AC 58 ms
66,864 KB
testcase_18 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import pypyjit
import itertools
import heapq
import math
from collections import deque, defaultdict, Counter
import bisect

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
pypyjit.set_param('max_unroll_recursion=-1')


def index_lt(a, x):
    'return largest index s.t. A[i] < x or -1 if it does not exist'
    return bisect.bisect_left(a, x) - 1


def index_le(a, x):
    'return largest index s.t. A[i] <= x or -1 if it does not exist'
    return bisect.bisect_right(a, x) - 1


def index_gt(a, x):
    'return smallest index s.t. A[i] > x or len(a) if it does not exist'
    return bisect.bisect_right(a, x)


def index_ge(a, x):
    'return smallest index s.t. A[i] >= x or len(a) if it does not exist'
    return bisect.bisect_left(a, x)


N = int(input())
A = list(map(int, input().split()))
C = {}
for a in A:
    C[a] = 1
L = 10 ** 6

for i in range(N):
    a = A[i]
    for j in range(2, L + 1):
        if a * j > L:
            break
        if C.get(a * j) is None:
            continue
        C[a * j] = max(C[a * j], C[a] + 1)
print(max(C.values()))
0