Skip to content

Instantly share code, notes, and snippets.

View hamadu's full-sized avatar

hamadu hamadu

View GitHub Profile
@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>
@hamadu
hamadu / fifo.c
Created September 6, 2017 14:23
fifo
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
int main(int argc, char* argv[]) {
mkfifo("fifo", S_IRWXU);
while (1) {
sleep(1);
}
return 0;
@hamadu
hamadu / client.c
Created September 3, 2017 11:07
network-io
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
void print_error_and_exit() {