Skip to content

Instantly share code, notes, and snippets.

Avatar

hamadu hamadu

View GitHub Profile
@hamadu
hamadu / solution.txt
Last active Jan 17, 2020
diverta 2019 Programming Contest: E - XOR Partitioning
View solution.txt
diverta 2019 Programming Contest: E - XOR Partitioning
https://atcoder.jp/contests/diverta2019/tasks/diverta2019_e
思考過程のメモ
## 観察
validな分け方の例を一つ考える。
```
View 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 Aug 2, 2018
VSCode Rust Debug Run
View launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "lldb",
"request": "launch",
"name": "Debug Run",
"sourceLanguages": [
"rust"
],
View server_thread.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 <signal.h>
View server_nonblocking.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 <signal.h>
View client.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 / client_weight_thread.c
Created Oct 11, 2017
client_weight_thread.c
View 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 Oct 11, 2017
server_multiplexing.c
View 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>
View fifo.c
#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;
View client.c
#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() {