complete 1463, 1931, 2156, 11053

This commit is contained in:
2021-02-22 02:13:36 +09:00
parent 02e2f2717d
commit a225d7c91e
5 changed files with 58 additions and 32 deletions

View File

@@ -0,0 +1,15 @@
N = int(input())
A = list(map(int, input().split()))
T = [0 for _ in range(N)]
T[0] = 1
for i in range(1, N):
t = []
for j in range(i):
if A[j] < A[i]:
t.append(T[j] + 1)
else:
t.append(1)
T[i] = max(t)
print(max(T))

View File

@@ -0,0 +1,15 @@
N = int(input())
T = [0, ]
for i in range(1, N):
new = i + 1
t = []
if new % 3 == 0:
t.append(T[new // 3 - 1] + 1)
if new % 2 == 0:
t.append(T[new // 2 - 1] + 1)
t.append(T[new - 1 - 1] + 1)
T.append(min(t))
print(T[-1])

View File

@@ -0,0 +1,13 @@
N = int(input())
I = [tuple(map(int, input().split())) for _ in range(N)]
I.sort(key=lambda x: (x[1], x[0]))
last = 0
cnt = 0
for i in range(N):
if last <= I[i][0]:
last = I[i][1]
cnt += 1
print(cnt)

View File

@@ -0,0 +1,15 @@
N = int(input())
I = [int(input()) for i in range(N)]
T = [[0 for _ in range(3)] for _ in range(N)]
T[0][0] = 0
T[0][1] = I[0]
T[0][2] = 0
for i in range(1, N):
T[i][0] = max((T[i-1][0], T[i - 1][1], T[i - 1][2]))
T[i][1] = T[i - 1][0] + I[i]
T[i][2] = T[i - 1][1] + I[i]
print(max(T[-1]))