]> Skullheadx's Git Forge - CCC.git/commitdiff
2015 S3
authorSkullheadx <94652084+Skullheadx@users.noreply.github.com>
Sat, 19 Nov 2022 20:52:51 +0000 (15:52 -0500)
committerSkullheadx <94652084+Skullheadx@users.noreply.github.com>
Sat, 19 Nov 2022 20:52:51 +0000 (15:52 -0500)
Main/Python/2015/S3.py [new file with mode: 0644]

diff --git a/Main/Python/2015/S3.py b/Main/Python/2015/S3.py
new file mode 100644 (file)
index 0000000..3fee27f
--- /dev/null
@@ -0,0 +1,20 @@
+G = int(input())
+P = int(input())
+
+closed = False
+count= 0
+docks = set()
+for i in range(P):
+    g = int(input())
+    if not closed:
+        can_land = False
+        for d in range(g,0,-1):
+            if d not in docks:
+                docks.add(d)
+                can_land = True
+                break
+        if not can_land:
+            closed = True
+        else:
+            count += 1
+print(count)