Yuhang's Blog

块状链表

例题:https://vjudge.net/problem/POJ-2887 要求支持字符串的插入(在第$x$位之前插入字符串$c$)、后缀(在整个字符串最后添加字符串$c$)、查询(查询当前第$x$位)操作。字符串长度1e6,操作数量2e3。 Read more

赌徒摊分问题

和另外两个朋友去吃饭,饭局结束玩德州扑克,说好拿出饭钱的90元按照游戏结束后的筹码分布进行摊分。牌局开始的时候每人有30个筹码;牌局结束,我剩下68个筹码,朋友A剩下22个,朋友B输光了。怎样分摊账单合理呢? Read more

Solving SQL Murder Mystery With Logica

Logica is a logic language for data manipulation developed by Google. It can be compiled into several SQL dialects, including BigQuery, SQLite and PostgreSQL. SQL, as a programming language, has several design flaws and suffers from bad readability especially when it comes to complex data queries. Logica has been aimed at mitigating those problems with SQL, and this post attempts to show that it does a quite good job in enhancing code readability and reusability, taking the SQL Murder Mystery as an example. Read more

Dual boot: Fix a broken GRUB

I have dual boot Windows 10 and Arch Linux Manjaro on my PC. It happened recently that after updating grub, grub terminal does not show up on booting and shortly afterwards Manjaro would always be launched, which meant Windows became inaccessible for me. Apparently the grub update interfered with the configurations on my machine and made it unable to work properly. Here is how I solved the problem. Read more