Skip to content

Commit

Permalink
Solve Laser Sculpture in python
Browse files Browse the repository at this point in the history
  • Loading branch information
deniscostadsc committed Sep 24, 2024
1 parent 5286168 commit 0483d45
Show file tree
Hide file tree
Showing 8 changed files with 3,091 additions and 0 deletions.
18 changes: 18 additions & 0 deletions solutions/beecrowd/1107/1107.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import sys

for line in sys.stdin:
if line.strip() == '0 0':
break

height, length = map(int, line.split())
blocks_heights = list(map(int, input().split()))

count_laser_moves = height - blocks_heights[0]
previous_height = blocks_heights[0]

for current_height in blocks_heights[1:]:
if current_height < previous_height:
count_laser_moves += previous_height - current_height
previous_height = current_height

print(count_laser_moves)
21 changes: 21 additions & 0 deletions solutions/beecrowd/1107/generate_in.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

set -euo pipefail

TESTCASES=1000
MAX_HEIGHT=1000
MAX_LENGTH=1000

for _ in $(seq "${TESTCASES}"); do
height="$((RANDOM % MAX_HEIGHT + 1))"
length="$((RANDOM % MAX_LENGTH + 1))"
echo "${height} ${length}"
for i in $(seq "${length}"); do
if [[ ${i} -ne 1 ]]; then
echo -n " "
fi
echo -n "$((RANDOM % (height + 1)))"
done
echo
done
echo "0 0"
Binary file added solutions/beecrowd/1107/imgs/UOJ_1107_a_en.webp
Binary file not shown.
Binary file added solutions/beecrowd/1107/imgs/UOJ_1107_b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2,001 changes: 2,001 additions & 0 deletions solutions/beecrowd/1107/in.txt

Large diffs are not rendered by default.

Loading

0 comments on commit 0483d45

Please sign in to comment.