Skip to content

Commit

Permalink
add examples
Browse files Browse the repository at this point in the history
  • Loading branch information
zehengl committed Dec 28, 2023
1 parent 2946f49 commit 121dfef
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/tornbygge.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
n = io.read("*n")
t = 0
top = 0
for _ = 1, n do
d = io.read("*n")
if top == 0 or d > top then
t = t + 1
end
top = d
end
print(t)
19 changes: 19 additions & 0 deletions src/trackingshares.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
c = int(input())
shares = {}
days = set()
for i in range(c):
k = int(input())
record = {}
for _ in range(k):
n, d = [int(d) for d in input().split()]
days.add(d)
record[d] = n
shares[i] = record

days = sorted(list(days))
ans = [0] * c
for i in range(len(days)):
d = days[i]
a = list(shares[j].get(d, ans[j]) for j in shares)
ans = a
print(sum(a), end=" ")

0 comments on commit 121dfef

Please sign in to comment.