Skip to content

Instantly share code, notes, and snippets.

View hamadu's full-sized avatar

hamadu hamadu

View GitHub Profile
@hamadu
hamadu / helpme.txt
Created November 15, 2012 06:19
問題が解けないとき/20分経っても方針が見えないならここを見る。
20分経っても方針が見えないならここを見る。数字が小さいほど優先度高い。
1. 問題文に見落としはないですか
- そもそもちゃんと問題読んだ?別の問題を解こうとしてない?
-- 似た問題を解いたことがある場合は特に注意する。
- 制約条件はちゃんと読みましたか
-- 指数時間のアルゴリズムで間に合ったりしない?
-- グラフは特殊な形をしてませんか
--- 木だったり、閉路の数だったり
--解けるものを「解けない」と勘違いしてませんか
package main
import (
"fmt"
"math/rand"
"os"
"strconv"
"runtime"
)
@hamadu
hamadu / solution.txt
Last active January 17, 2020 16:30
diverta 2019 Programming Contest: E - XOR Partitioning
diverta 2019 Programming Contest: E - XOR Partitioning
https://atcoder.jp/contests/diverta2019/tasks/diverta2019_e
思考過程のメモ
## 観察
validな分け方の例を一つ考える。
```
@hamadu
hamadu / combo_grader.rb
Created September 12, 2018 03:43
combo_grader.rb
# problem statement: https://ioi2018.jp/wp-content/tasks/contest1/combo.pdf
# usage: ruby combo_grader.rb "your program"
class ComboGrader
KEYS = %w[A B X Y].freeze
COMMAND_LENGTH = 100
QUERY_LENGTH_LIMIT = COMMAND_LENGTH * 4
QUERY_LIMIT = 103
def run(program)
@program = IO.popen(program, mode = "r+")
@hamadu
hamadu / launch.json
Last active August 2, 2018 13:59
VSCode Rust Debug Run
{
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug Run",
"sourceLanguages": [
"rust"
],
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
@hamadu
hamadu / client_weight_thread.c
Created October 11, 2017 13:22
client_weight_thread.c
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
@hamadu
hamadu / server_multiplexing.c
Created October 11, 2017 13:20
server_multiplexing.c
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/epoll.h>