Skip to content

Instantly share code, notes, and snippets.

@kusano
kusano / weird_editor.cpp
Created May 15, 2017 06:55
Distributed Code Jam 2017 Round 1 C. weird_editor
#include "message.h"
#include "weird_editor.h"
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
long long N = NumberOfNodes();
long long ID = MyNodeId();
@kusano
kusano / broken_memory.cpp
Created June 11, 2017 17:15
Distributed Code Jam 2017 Round 2 D
#include "message.h"
#include "broken_memory.h"
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
int main() {
long long N = NumberOfNodes();
import sys
import re
mail = []
reform = re.compile(r"^From - \w{3} \w{3} \d\d \d\d:\d\d:\d\d \d\d\d\d\r?$")
restatus = re.compile(r"^(X-Mozilla-Status: )(\d\d\d\d)(\r?)$")
output = open("deleted", "wb")
def process():
#include <string>
#include <vector>
using namespace std;
class SpecificPolyominoCovering{public:
vector <string> findCovering( vector <string> region )
{
int w = (int)region[0].size();
int h = (int)region.size();
@kusano
kusano / 1_leapfrog_ch1.py
Created June 17, 2019 17:04
Facebook Hacker Cup 2019 Qualification Round
# coding: utf-8
"""
https://www.facebook.com/hackercup/problem/656203948152907/
βカエルの数をbとする。
b=N-1のとき、葉Nが空いていないので不可。
bを小さくすることを考えると、1個おきに並ぶのが最善で、2*b=N-1。
"""
@kusano
kusano / LBL.txt
Last active June 30, 2019 20:22
LBL
OLL
・・・
□□□
・・・
FRUR'U'F'
・・・
・□□
・□・
@kusano
kusano / 1_graphs_as_a_service.py
Created June 30, 2019 17:04
Facebook Hacker Cup 2019 Round 1
T = input()
for t in range(T):
N, M = map(int, raw_input().split())
R = []
for _ in range(M):
X, Y, Z = map(int, raw_input().split())
R += [(X-1, Y-1, Z)]
oo = 999999999
G = [[oo]*N for _ in range(N)]
@kusano
kusano / 1_on_the_run.py
Created July 13, 2019 20:02
Facebook Hacker Cup 2019 Round 2
T = input()
for t in range(T):
N, M, K = map(int, raw_input().split())
A, B = map(int, raw_input().split())
A -= 1
B -= 1
R = [0]*K
C = [0]*K
for i in range(K):
R[i], C[i] = map(int, raw_input().split())
@kusano
kusano / 00memo.js
Last active September 22, 2019 14:54
技術書典のかんたん後払いシステム集計スクリプト
// https://techbookfest.org/market/distributor/watch
// をChromeで開いて、開発者コンソールを開き、
ws = new WebSocket("wss://s-usc1c-nss-223.firebaseio.com/.ws?v=5&ns=tbf-tokyo")
x = ""
ws.addEventListener('message', e=>{x+=e.data+"\n"})
ws.send('{"t":"d","d":{"r":1,"a":"s","b":{"c":{"sdk.js.6-6-0":1}}}}')
// 開発者コンソールのNetwork → WS → Messagesからコピー
ws.send('{"t":"d","d":{"r":2,"a":"auth","b":{"cred":"????"}}}')
// 同じくコピー
ws.send('{"t":"d","d":{"r":3,"a":"q","b":{"p":"/market/handshake/distributor/????","h":""}}}')