Skip to content

Instantly share code, notes, and snippets.

View snuke's full-sized avatar
🤷‍♀️

snuke snuke

🤷‍♀️
View GitHub Profile
@snuke
snuke / readme.txt
Created May 10, 2024 18:13
MOYOU (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
@snuke
snuke / dijkstra_generator.cpp
Created February 22, 2021 01:20
ダイクストラのコーナーケースのジェネレータ
#include <bits/stdc++.h>
using namespace std;
int TYPE = 1; // 1:continue忘れ, 2:最大ヒープ, 3:最大ヒープ2, 4:負辺
int MAX_N = 2e5; // 頂点数の最大値
int MAX_M = 2e5; // 辺数の最大値
int MIN_C = 1; // 辺のコストの最小値
int MAX_C = 1e9; // 辺のコストの最大値
bool DIRECTED = false; // 有向かどうか
bool V1_TO_Vn = false; // s=1, t=n とするかどうか
@snuke
snuke / 0058 - Sort 4
Last active May 26, 2020 14:14
MAO 0058 - Sort 4
https://mao.snuke.org/tasks/58
@snuke
snuke / 0049 - Baba 1
Last active May 24, 2020 14:50
MAO Contest 002
bb:ba
@snuke
snuke / straight.txt
Created December 25, 2019 15:48
1 box sokoban O(n^2)
....#...#...#...#...#...#...#...#...#...#......
.##.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.####.
..#...#...#...#...#...#...#...#...#...#...#.SS.
#BB#########################################SS#
PBB..#.....#.....#.....#.....#.....#.....#.....
.....#.#......#..#.#......#..#.#......#..#.#...
.#...#...........#...........#...........#.....
.....#.....#.....#.....#.....#.....#.....#.....
##..###..#####..###..#####..###..#####..###..##
.....#.....#.....#.....#.....#.....#.....#.....
@snuke
snuke / sol.py
Created December 21, 2019 09:10
天下一GameBattleContest(β)
#!/usr/bin/env python3
"""
辺をランダムに取得し、点数を計算するサンプルプログラムです。
実行には python3 環境が必要です。
TOKEN 変数を書き換えて実行してください。
"""
import os
import random
@snuke
snuke / K.cpp
Created September 15, 2019 14:31
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
import optuna
import random
n = 5
T = 1000
param_bank = [[1/(n-i) for i in range(n-1)]]
def objective(trial):
param = []
for i in range(n-1):
@snuke
snuke / fix_rotation.py
Last active August 21, 2019 19:45
detect icon rotation
# -*- coding: utf-8 -*-
import cv2
import numpy as np
def fix(name):
src = cv2.imread(name)
h,w = src.shape[:2]
r = min(h,w)/2 - 1
center = np.array([w/2,h/2])
@snuke
snuke / icon_rotate.py
Last active June 15, 2019 01:59
rotate twitter icon
import twitter # pip install python-twitter
from PIL import Image # pip install pillow
import datetime, calendar
icon_path = 'icon.jpg'
save_path = 'tmp.jpg'
api = twitter.Api(
consumer_key='',
consumer_secret='',
access_token_key='',