Import LeetCode problems with usaco new <link> / usaco daily
usaco new <leetcode-link> (alias: from) and usaco daily fetch a problem from LeetCode's GraphQL API and write problem.md, main.cpp (template header + LeetCode's C++ starter), a generated driver.h that runs the solution on LeetCode-format input, and the examples as tests with the expected outputs from the statement. leetcode.h holds ListNode/TreeNode and the parse/print helpers; everything local sits behind #ifdef LOCAL so main.cpp stays submittable. reset re-fetches the starter code for LeetCode problems, the REPL's new selects the imported problem, and usaco.zsh turns off globbing so a pasted ?envType=... link works unquoted. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -19,6 +19,8 @@ const sections = [
|
||||
["usaco new <name>", "Create solving/<name>/ with main.cpp from the template and an empty .in file, then open it in $EDITOR."],
|
||||
["usaco new <name> <io>", "Same, when the USACO file name differs from the problem name."],
|
||||
["usaco new <name> --url <link>", "Also save the problem link, for usaco open."],
|
||||
["usaco new <leetcode-link>", "Import a LeetCode problem (also usaco from): the statement as problem.md, LeetCode's C++ starter code in main.cpp, a generated driver.h that runs it on LeetCode-format input, and the examples as tests with their expected outputs."],
|
||||
["usaco daily", "The same, for today's LeetCode daily question."],
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user