結果
| 問題 |
No.979 Longest Divisor Sequence
|
| ユーザー |
tamato
|
| 提出日時 | 2020-01-31 22:15:26 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 751 bytes |
| コンパイル時間 | 147 ms |
| コンパイル使用メモリ | 82,516 KB |
| 実行使用メモリ | 130,276 KB |
| 最終ジャッジ日時 | 2024-09-17 08:35:38 |
| 合計ジャッジ時間 | 4,602 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 TLE * 1 -- * 2 |
ソースコード
def main():
import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
dp = [[A[0]]]
for a in A[1:]:
ok = -1
ng = len(dp)
mid = (ok+ng)//2
while ng - ok > 1:
flg = 0
for b in dp[mid]:
if a%b == 0 and a > b:
#print(a, b, mid)
flg = 1
break
if flg:
#print(a, mid)
ok = mid
else:
ng = mid
mid = (ok+ng)//2
if ok == len(dp)-1:
dp.append([a])
else:
dp[ok+1].append(a)
print(len(dp))
#print(dp)
if __name__ == '__main__':
main()
tamato