Separate lib, new problems and script for web

This commit is contained in:
2026-08-26 22:25:19 +01:00
parent 6fd6d70b04
commit afdab7d4bd
44 changed files with 1060 additions and 211 deletions
+20
View File
@@ -0,0 +1,20 @@
# usaco stats
count() { [[ -d "$1" ]] && find "$1" -mindepth 1 -maxdepth 1 -type d | wc -l || echo 0; }
solved=$(count "$ROOT/solved"); solving=$(count "$ROOT/solving"); skipped=$(count "$ROOT/skipped")
now=$(date +%s); week=0; month=0
if [[ -d "$ROOT/solved" ]]; then
for d in "$ROOT/solved"/*/; do
[[ -d "$d" ]] || continue
t="$(find "$d" -type f -printf '%T@\n' | sort -n | tail -1 | cut -d. -f1)"
[[ -z "$t" ]] && continue
age=$(( now - t ))
(( age <= 7*86400 )) && week=$((week+1))
(( age <= 30*86400 )) && month=$((month+1))
done
fi
echo "Solved: $solved"
echo "Solving: $solving"
echo "Skipped: $skipped"
echo
echo "Solved in last 7 days: $week"
echo "Solved in last 30 days: $month"