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
+21
View File
@@ -0,0 +1,21 @@
# usaco new <name> [io-name] [--url <link>]
[[ $# -ge 1 ]] || usage
name=""; io=""; url=""
while [[ $# -gt 0 ]]; do
case "$1" in
--url) url="${2:-}"; shift 2 ;;
*) if [[ -z "$name" ]]; then name="$1"; elif [[ -z "$io" ]]; then io="$1"; fi; shift ;;
esac
done
[[ -n "$name" ]] || usage
io="${io:-$name}"
dir="$ROOT/solving/$name"
if [[ -d "$dir" || -d "$ROOT/solved/$name" || -d "$ROOT/skipped/$name" ]]; then
echo "Error: '$name' already exists" >&2; exit 1
fi
mkdir -p "$dir"
fresh_main "$dir" "$io"
touch "$dir/$io.in"
[[ -n "$url" ]] && echo "$url" > "$dir/.url"
echo "Created solving/$name (io: $io.in / $io.out)"
(cd "$dir" && exec ${EDITOR:-nvim} main.cpp)