Skip to content

Instantly share code, notes, and snippets.

👨‍🏭
On internship

Zheng Luo htfy96

👨‍🏭
On internship
Block or report user

Report or block htfy96

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@htfy96
htfy96 / cdq.cpp
Last active Dec 19, 2018
Solution to CF Educational Round 56 Problem E, with CDQ divide-and-conquer (CDQ分治)
View cdq.cpp
#include <bits/stdc++.h>
/*
https://codeforces.com/contest/1093/problem/E
Convert all modification and query into single-point events (t, x, y). Initially sort by t,
for each interval, recursively handle independent two parts. Then calc the interference
between part one and two: only mod in part 1 can affect result in part 2. Therefore, we can
sort part1 and 2 respectively by x, then process all mod event in part 1 and all query events in
part 2 in a sort-merge-like way. The Y-dimension is maintained with a fenwick tree.
In the end all elements will be sorted by x.
View discrete.cpp
#include <bits/stdc++.h>
using namespace std;
int main()
{
vector<int> a {1, 3, 3, 2, 5};
vector<int> b;
for (int i=0; i<a.size(); ++i)
b.push_back(i);
@htfy96
htfy96 / proof.md
Created Sep 19, 2018
Proof of identication
View proof.md

I hereby claim:

  • I am the person who sends Wechat messages and moments at Sept 18 22:07 - 22:17 PDT from account @VicLuo96

To claim this, I sign this message with my pubkey 0x98809CA08BF5662A:

I hereby claim:

- I am the person who sends Wechat messages and moments at Sept 18 22:07 - 22:17 PDT from account @VicLuo96
@htfy96
htfy96 / A-small-attempt-3.out
Created Jul 29, 2018
GCJ Kickstart Round D Problem A: Solution and sample data
View A-small-attempt-3.out
Case #1: 13
Case #2: IMPOSSIBLE
Case #3: 2
Case #4: 386239
Case #5: IMPOSSIBLE
Case #6: IMPOSSIBLE
Case #7: IMPOSSIBLE
Case #8: 84609596512776
Case #9: 0
Case #10: 1155268877829
@htfy96
htfy96 / feeds.opml
Created Jun 27, 2018
My feedly feeds collection
View feeds.opml
<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
<head>
<title>Vic subscriptions in feedly Cloud</title>
</head>
<body>
<outline text="news" title="news">
<outline type="rss" text="路透: 时事要闻" title="路透: 时事要闻" xmlUrl="http://cn.reuters.com/rssFeed/CNTopGenNews/" htmlUrl="http://cn.reuters.com"/>
<outline type="rss" text="Washington Post: Breaking News, World, US, DC News &amp; Analysis" title="Washington Post: Breaking News, World, US, DC News &amp; Analysis" xmlUrl="http://www.washingtonpost.com/rss/homepage" htmlUrl="http://www.washingtonpost.com/pb/homepage/"/>
@htfy96
htfy96 / README.md
Last active Dec 19, 2018
Restrict C++ unsafe behaviors in unsafe{} block using clang-query and simple commands
View README.md

C++ has a lot of dark corners. Unfortunately, sometimes we need to allow inexperienced developers to write some C++ code to meet the deadline. The intersection of the two cases often makes things worse: programmers used to delegate memory management to garbage collection tend to throw off new everywhere in the source, and those stuck with compile error will use every evil hack to get around with it. Code review is a feasible way to ensure code quality in this case, but a better choice is to restrict them into a relatively safe subset of the language.

In this article, I will show how to use clang-query and a simple script to restrict some unsafe behaviors in unsafe block/namespace using simple commands:

#include "common.hpp"

struct X {
    int f: 2; // error: use of bit field without enclosing Unsafe
};
@htfy96
htfy96 / IteratedRun.sol
Last active Jun 17, 2018
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.24+commit.e67f0147.js&optimize=true&gist=
View IteratedRun.sol
pragma solidity ^0.4.0;
contract IteratedRun {
struct City {
bytes32 name;
bool visited;
}
address owner;
City[] cities;
@htfy96
htfy96 / strong-datas.md
Last active Jun 2, 2018
839-strong-datas
View strong-datas.md

2000 strings, all 'aaaaaaaaa'

["aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaaaa", "aaaaaaa
@htfy96
htfy96 / bookmarklet.md
Last active May 15, 2018
Simple bookmarklet to send current webpage to dyweb/weekly
View bookmarklet.md

Add the following target to your bookmark bar.

Remember to replace %24YOUR_TOKEN_HERE with your Github personal access token. The token could be acquired at Settings -> Developer Settings -> Personal Access Token and check public_repo permission.

javascript:(function()%7Bconst%20apiRequest%20%3D%20(src%2C%20param)%20%3D%3E%20fetch('https%3A%2F%2Fapi.github.com%2F'%20%2B%20src%2C%20Object.assign(%7Bheaders%3A%20%7B%20Accept%3A%20'application%2Fvnd.github.v3%2Bjson'%2C%20'Content-Type'%3A%20'application%2Fjson'%2C%20Authorization%3A%20'token%20%24YOUR_TOKEN_HERE'%20%7D%7D%2C%20param))%3BapiRequest('repos%2Fdyweb%2Fweekly%2Fissues').then(v%20%3D%3E%20v.json()).then(d%20%3D%3E%20d.filter(item%20%3D%3E%20item.labels.some(lab%20%3D%3E%20lab.name%20%3D%3D%3D%20'working'))%5B0%5D.number).then(issuenum%20%3D%3E%20%7Bconst%20url%20%3D%20'repos%2Fdyweb%2Fweekly%2Fissues%2F'%20%2B%20issuenum%20%2B%20'%2Fcomments'%3Bconst%20description%20%3D%20window.prompt('Please%20input%20your%20description%20of%20this%2
@htfy96
htfy96 / bad_rendering_results.md
Last active Dec 27, 2017
A collection of my bad rendering results
You can’t perform that action at this time.