TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Lessons Learnt from Solving AoC in One Second

17 点作者 sulami超过 2 年前

2 条评论

mappu超过 2 年前
Sorry - if this is your website, could you please not hide the scrollbar?<p>The CSS file has a comment <i>This below keeps the regular scrollbar for scrolling the page, if present, because that one makes sense to be there.</i> but it doesn&#x27;t seem to be taking effect for me.<p>Regarding the AoC i&#x27;m very impressed with adding the extra time constraint on yourself.
评论 #34154686 未加载
powersnail超过 2 年前
`nom` is incredible. I used to iterate input by line, make up regex with capture groups, and do something ad hoc if the input isn&#x27;t line by line. It gets quite ugly, if the input has multiple parts, or multiple lines as one part.<p>Now I just take the whole stdin and pass it into a parser written in `nom`. If it&#x27;s line-by-line, it&#x27;s a trivial: `separated_list1(tag(&quot;\n&quot;), parse_line)`, not more difficult than iterating through lines, parsing each, and combining them. If the input isn&#x27;t line-by-line, a proper parser is way more cleaner than anything I&#x27;ve done before.<p>And there has never been a performance problem for me. (To be fair, AOC doesn&#x27;t have truly giant input size)