Skip to content

Instantly share code, notes, and snippets.

@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 / LBL.txt
Last active June 30, 2019 20:22
LBL
OLL
・・・
□□□
・・・
FRUR'U'F'
・・・
・□□
・□・
@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。
"""
#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();
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():
@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();
@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 / salient_strings.cpp
Created January 29, 2017 02:46
Facebook Hacker Cup 2017 Round 3 A
#include <iostream>
#include <vector>
#include <string>
#include <cstdio>
using namespace std;
int main()
{
int T;
parameter N = 4;
reg [31:0] n [0:N-1];
reg [31:0] count;
reg [31:0] max;
integer i;
always @(negedge rst or posedge clk) begin
if (rst==1'd0) begin
n[0] <= 32'd123;
n[1] <= 32'd456;