diff --git a/storage/aloha/py/2025cherry-div1-A.py b/storage/aloha/py/2025cherry-div1-A.py new file mode 100644 index 0000000..aa16896 --- /dev/null +++ b/storage/aloha/py/2025cherry-div1-A.py @@ -0,0 +1,59 @@ +import sys + +input = sys.stdin.readline + + +class FibonacciCoin: + def __init__(self, n, arr): + self.n = n + self.arr = arr + + def solve(self) -> list[int]: + cnts: list[int] = [] + curr = [0] * 1_200_000 + if self.arr[0] == 1 or self.arr[0] == 2: + curr[2] = 1 + else: + curr[self.arr[0]] = 1 + cnts.append(1) + for i in range(1, self.n): + cnt = cnts[-1] + if self.arr[i] == 1 or self.arr[i] == 2: + curr[2] += 1 + if curr[2] == 2: + curr[2] = 0 + curr[3] += 1 + else: + cnt += 1 + t = 3 + else: + curr[self.arr[i]] += 1 + t = self.arr[i] + cnt += 1 + while True: + if curr[t] >= 1 and curr[t - 1] >= 1: + curr[t] -= 1 + curr[t - 1] -= 1 + curr[t + 1] += 1 + cnt -= 1 + t = t + 1 + elif curr[t] >= 1 and curr[t + 1] >= 1: + s = min([curr[t], curr[t + 1]]) + curr[t] -= 1 + curr[t + 1] -= 1 + curr[t + 2] += 1 + cnt -= 1 + t = t + 2 + else: + break + cnts.append(cnt) + return cnts + + +if __name__ == '__main__': + n = int(input()) + arr = list(map(int, input().split())) + + solver = FibonacciCoin(n, arr) + + print(*solver.solve(), sep=' ') diff --git a/storage/aloha/py/2025cherry-div1-C.py b/storage/aloha/py/2025cherry-div1-C.py new file mode 100644 index 0000000..e3a946e --- /dev/null +++ b/storage/aloha/py/2025cherry-div1-C.py @@ -0,0 +1,33 @@ +import sys + +input = sys.stdin.readline + + +class ReverseSortTracer: + def __init__(self, n, arr): + self.n = n + self.arr = arr + + def sort_trace(self) -> list[tuple[int, int]]: + qx = [] + sorted_arr = self.arr.copy() + + for i in range(1, self.n): + l = i + r = sorted_arr.index(i) + 1 + for ptr in range((r - l + 1) // 2): + sorted_arr[l + ptr - 1], sorted_arr[r - 1 - ptr] = \ + sorted_arr[r - 1 - ptr], sorted_arr[l + ptr - 1] + qx.append((l, r)) + + return qx + + +if __name__ == "__main__": + n = int(input()) + arr = list(map(int, input().split())) + + solved = ReverseSortTracer(n, arr).sort_trace() + print(len(solved)) + for pair in solved: + print(*pair) diff --git a/storage/aloha/py/2025cherry-div1-D.py b/storage/aloha/py/2025cherry-div1-D.py new file mode 100644 index 0000000..bf8bfd0 --- /dev/null +++ b/storage/aloha/py/2025cherry-div1-D.py @@ -0,0 +1,26 @@ +import sys + +input = sys.stdin.readline + + +class ALOHAGames: + def __init__(self): + self.t = 1 + self.f = 0 + self.res_mineral = 4000 + self.res_propane = 3000 + + +# R1 + + +if __name__ == "__main__": + print("""8 +max(1,1) +min(2,3) +plus(1,1,1) +plus(3,3,2) +max(3,3) +submit(1,1) +minus(9,9,3) +submit(3,3)""") diff --git a/storage/aloha/py/completed/2025cherry-div1-B.py b/storage/aloha/py/completed/2025cherry-div1-B.py new file mode 100644 index 0000000..58e3d2e --- /dev/null +++ b/storage/aloha/py/completed/2025cherry-div1-B.py @@ -0,0 +1,19 @@ +import sys + +input = sys.stdin.readline + + +class SeongjunEncryption: + def __init__(self, n, t): + self.n = n + self.t = t + + def solve(self) -> bool: + return self.t[0] == 'A' and self.t[-1] == 'B' + + +if __name__ == "__main__": + n = int(input()) + t = input().strip() + + print("Yes" if SeongjunEncryption(n, t).solve() else "No")