Skip to content

Instantly share code, notes, and snippets.

View NachiaVivias's full-sized avatar

NachiaVivias

  • Osaka Metropolian University College of Technology
  • Japan
  • X @NachiaVivias
View GitHub Profile
@NachiaVivias
NachiaVivias / Main.cpp
Last active October 24, 2025 13:58
Procon36 brief visualizer
# include <Siv3D.hpp> // Siv3D v0.6.15
// #define ForWeb
static inline String SampleProblemJson = UR"({"problem":{"field":{"size":4,"entities":[[6,3,4,0],[1,5,3,5],[2,7,0,6],[1,2,7,4]]}}})";
static inline String SampleSolutionJson = UR"({"ops": [{"n": 2,"x": 0,"y": 0},{"n": 3,"x": 1,"y": 1},{"n": 2,"x": 2,"y": 1},{"n": 2,"x": 2,"y": 2},{"n": 2,"x": 2,"y": 2}]})";
struct VerifyResult {
bool isOk;
@NachiaVivias
NachiaVivias / knapsack.cpp
Created July 1, 2025 14:57
競プロ的ナップサック問題11問
// The main purpose of this implementation is
// to show rough code patterns of solutions.
// I cannot guarantee the actual correctness of this code.
// Error reporting is welcome.
// 本ソースコードは解法の構造を示すためのものであり、
// 実際に正しく計算できることはあまり確認していません。
#include <vector>
#include <algorithm>
@NachiaVivias
NachiaVivias / Main.cpp
Last active December 23, 2024 08:00
Procon35 brief visualiser
#include <Siv3D.hpp> // Siv3D v0.6.14
namespace Procon35 {
using BoardElement = int8;
using Pattern = Grid<BoardElement>;
using Board = Grid<int8>;
const int32 FixedPatternsCount = 25;
@NachiaVivias
NachiaVivias / IsPrime.cpp
Last active December 16, 2024 23:40
ch20-primality-test example
#pragma once
#include <Siv3D.hpp> // v0.6.15
namespace nachia {
constexpr bool ISPRIME_DEBUG = false;
struct Uint128Util {
# include <Siv3D.hpp> // Siv3D v0.6.15
// Circle{ p0, p1 } で、p0 と p1 を結ぶ線分を直径とする円を作成できます。
// triangle.getCircumscribedCircle() で三角形の外接円を作成できます。
struct DrawPoint {
@NachiaVivias
NachiaVivias / amortized-deque.hpp
Last active May 15, 2024 17:54
Double-Ended Palindromic Tree
#pragma once
#include <vector>
#include <algorithm>
#include <iterator>
namespace nachia {
template<class Elem>
struct AmortizedDeque {
private:
@NachiaVivias
NachiaVivias / count-unlabeled-connected-graph.py
Last active May 13, 2024 12:54
OEIS A001349 を計算する Python プログラム
from fractions import Fraction
import math
# 定数項のみ val 、それ以外は 0
def constant_fps(n, val) :
res = [Fraction(0) for _ in range(n)]
res[0] = val
return res
# 全部ゼロ
@NachiaVivias
NachiaVivias / 01_guide.md
Last active April 22, 2024 13:14
FPS composition f(g(x)) の実装について
@NachiaVivias
NachiaVivias / main.cpp
Last active March 26, 2024 10:55
等高線集約クエリのランダムテスト用
// 計算内容:
// 配列 long long A[n][n] が与えられる。はじめ、配列 X[n] の要素はすべて 0 である。
// v = 0..n-1 , d = 0..n-1 について、 v からの距離が d である頂点 x について、 X[x] に A[v][d] を加算する。
// 最終的な配列 X を求めよ。
//#define _GLIBCXX_DEBUG
#include <iostream>
#include <string>
#include <vector>
@NachiaVivias
NachiaVivias / abc337g.nim
Last active February 12, 2024 08:35
Heavy-Light Decompositions in Nim
# https://atcoder.jp/contests/abc337/tasks/abc337_g
include hld
import std/strutils
proc ABC337G() =
var N = stdin.readLine.parseInt
var tree = newGraph(N, true, N-1)
for i in 0..<N-1:
var uv = stdin.readLine.split.map parseInt