Skip to content

Commit

Permalink
Improve but does not solve
Browse files Browse the repository at this point in the history
  • Loading branch information
deniscostadsc committed Jul 10, 2024
1 parent 5fe11fc commit c95f505
Show file tree
Hide file tree
Showing 6 changed files with 1,843 additions and 25 deletions.
13 changes: 8 additions & 5 deletions solutions/beecrowd/1084/1084.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ def remove(_str, index):
break

prize = input()

while d:
possibilities = [remove(prize, i) for i, _ in enumerate(prize)]
possibilities.sort(key=int)
prize = possibilities[-1]
current_digit = 0

for i in range(d):
index = prize.find(str(current_digit))
if index == -1:
current_digit += 1
index = prize.find(str(current_digit))
prize = remove(prize, index)

d -= 1

Expand Down
Empty file removed solutions/beecrowd/1084/WRONG
Empty file.
20 changes: 20 additions & 0 deletions solutions/beecrowd/1084/generate_in.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
#!/usr/bin/env bash

set -euo pipefail

TESTCASES=600
DIGITS=(1 2 3 4 5 6 7 8 9 0)
n_range=10

for (( i = 0; i < TESTCASES; i++ )); do
n=$((RANDOM % n_range + 10))
d=$((RANDOM % n))
if [[ d -eq 0 ]]; then
d=1
fi
echo "${n} ${d}"
for (( j = 0; j < n; j++ )); do
echo -n "${DIGITS[$((RANDOM % 10))]}"
done
echo ""
n_range=$((n_range + 3))
done

echo "0 0"
Loading

0 comments on commit c95f505

Please sign in to comment.