Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
💻

Joona Yoon joonas-yoon

💭
💻
View GitHub Profile
@joonas-yoon
joonas-yoon / uva-136-ugly-numbers.cpp
Created Jul 6, 2020
UVa 136, POJ 1338 - Ugly Numbers
View uva-136-ugly-numbers.cpp
#include <cstdio>
#include <vector>
#include <queue>
using namespace std;
typedef long long lld;
struct node {
node(lld d, int p) : data(d), prev(p) {}
lld data;
View boj-11012.cpp
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i=0; i<(n); ++i)
#define REP(i, a, b) for(int i=(a); i<(b); ++i)
#define all(v) (v).begin(), (v).end()
#define SIZE(v) ((int)(v).size())
typedef long long lld;
typedef pair<int, int> ii;
@joonas-yoon
joonas-yoon / hot-brains-e95-4.py
Last active Jun 9, 2020
문제적 남자 95화 - 리모트 뷰잉 뇌풀기 - 4번 문제
View hot-brains-e95-4.py
from itertools import permutations
# AB*C = DE-F = GH/I
def validate(a):
ABC = (10*a[0] + a[1]) * a[2]
DEF = (10*a[3] + a[4]) - a[5]
if ABC != DEF:
return False
GH, I = 10*a[6] + a[7], a[8]
if GH % I != 0 or ABC != (GH / I):
@joonas-yoon
joonas-yoon / gtest.rb
Last active Jun 4, 2020 — forked from Kronuz/gtest.rb
Homebrew Formula for Google Test
View gtest.rb
# Homebrew Formula for Google Test
# Usage: brew install --HEAD https://gist.githubusercontent.com/joonas-yoon/9ec4ce1c1374ba8b8473020ced3879d8/raw/gtest.rb
require 'formula'
class Gtest < Formula
desc "Google Test"
homepage "https://github.com/google/googletest"
head "git://github.com/google/googletest.git", :using => :git
View boj-3640.cpp
#include <bits/stdc++.h>
using namespace std;
typedef long long lld;
typedef pair<int, int> ii;
const int INF = 0x3f3f3f3f;
const lld LNF = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1e9 + 7;
@joonas-yoon
joonas-yoon / boj-15480.cpp
Created May 15, 2020
BOJ 15480 - LCA와 쿼리
View boj-15480.cpp
#include <bits/stdc++.h>
using namespace std;
#define MAX_N 100001
#define MAX_DEP 18
int N;
vector<int> adj[MAX_N];
int depth[MAX_N];
int parent[MAX_N][MAX_DEP]; // N번째 노드의 2^K번째 부모 노드
View eulerian-path.cpp
#define MAX_V 100001
int id = 0;
int L[MAX_V], R[MAX_V]; // [L, R]
vector<int> adj[MAX_V];
int dfs(int cur) {
int i = ++id, cnt = 0;
L[cur] = i;
for (auto& nxt : adj[cur]) {
View boj-9034.cpp
#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(),(v).end()
struct seg {
int n;
vector<int> t;
void build(int sz) {
@joonas-yoon
joonas-yoon / 1539.cpp
Created Apr 17, 2020
BOJ 1539 - 이진 검색 트리
View 1539.cpp
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i=0; i<(n); ++i)
typedef long long lld;
map<int, int> h1, h2;
int main() {
@joonas-yoon
joonas-yoon / boj-18109-automata.cpp
Created Apr 2, 2020
BOJ 18109 - 도깨비불 (오토마타 풀이)
View boj-18109-automata.cpp
#include <bits/stdc++.h>
using namespace std;
#define CONSO 0
#define VOWEL 1
#define COMBINE_C 2
#define COMBINE_V 3
bool isVowel[255];
set<string> cVowel, cConso;
You can’t perform that action at this time.