Last active
May 3, 2021 00:51
-
-
Save KilJaeeun/7db68d57a366ffc6d4a0b349393d5d88 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
๐ Morning 138 commits โโโโโโโโโโโโโโโโโโโโโ 16.8% | |
๐ Daytime 316 commits โโโโโโโโโโโโโโโโโโโโโ 38.4% | |
๐ Evening 276 commits โโโโโโโโโโโโโโโโโโโโโ 33.6% | |
๐ Night 92 commits โโโโโโโโโโโโโโโโโโโโโ 11.2% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import collections | |
import copy | |
import heapq | |
import math | |
import sys | |
import time | |
def make_table(p): | |
length = len(p) | |
table = [0] * len(p) | |
j = 0 | |
for i in range(1, length): | |
while j > 0 and p[i] != p[j]: | |
j = table[j - 1] | |
if p[i] == p[j]: | |
j += 1 | |
table[i] = j | |
return table | |
def kmp(p, s): | |
table = make_table(p) | |
j = 0 | |
answers = [] | |
answer = 0 | |
aaa = 0 | |
for i in range(len(s)): | |
while j > 0 and s[i] != p[j]: | |
j = table[j - 1] | |
if s[i] == p[j]: | |
if j == len(p) - 1: | |
answers.append(i - j + 1) | |
answer += 1 | |
j = table[j] | |
else: | |
j += 1 | |
return answer, answers | |
def printTime(): | |
start_time = int(round(time.time() * 1000)) | |
main() | |
end_time = int(round(time.time() * 1000)) | |
print('some_func()์ ์คํ ์๊ฐ : %d(ms)' % (end_time - start_time)) | |
return | |
""" | |
bin(42) | |
int('0b111100', 2) | |
oct(42) | |
hex(42) | |
ord() | |
chr() | |
arr.reverse() # ๋ฐฐ์ด ๊ฑฐ๊พธ๋ก | |
list.count(์ฐพ๋ ๊ฐ) # ๊ฐ์ด ๋ฐฐ์ด์ ๋ช ๊ฐ๊ฐ ์๋์ง( ๋ฌธ์์ด๋ ๊ฐ๋ฅ) | |
arr.sort(key=lambda x:(x[0], x[1])) | |
res = a if a > b else b | |
""" | |
sys.setrecursionlimit(10 ** 4) | |
input = sys.stdin.readline | |
def print(a): | |
sys.stdout.write(str(a)) | |
def hpop(ALIST): | |
heapq.heapppop(ALIST) | |
def log2(i): | |
return math.log(i, 2) | |
def iinput(): return int(input()) | |
def lisinput(): return list(map(int, input().split())) | |
def minput(): return map(int, input().split()) | |
def liinput(): return list(map(int, list(input()))) | |
def dq(): return collections.deque([]) | |
def popl(a): return a.popleft() | |
def appendl(a, b): | |
a.appendleft(b) | |
return a | |
move = [ | |
[-1, 0], # ์ผ | |
[0, -1], # ์๋ | |
[1, 0], # ์ค๋ฅธ์ชฝ | |
[0, 1], # ์ | |
] | |
def in_r(x, N): | |
return (0 <= x[0] and x[0] < N and 0 <= x[1] and x[1] < N) | |
def in_rc(x, r, c): | |
return (0 <= x[0] and x[0] < r and 0 <= x[1] and x[1] < c) | |
def addNode(a, b): | |
return [a[0] + b[0], a[1] + b[1]] | |
def returnValue(graph, node): | |
return graph[node[0]][node[1]] | |
def add(A, value, maps): | |
maps[A[0]][A[1]] += value | |
return maps | |
def transpose(graph): | |
return list(map(list, zip(*graph))) | |
def make_table(): | |
length = len(p) | |
table = [0] * len(p) | |
j = 0 | |
for i in range(1, length): | |
while j > 0 and p[i] != p[j]: | |
j = table[j - 1] | |
if p[i] == p[j]: | |
j += 1 | |
table[i] = j | |
return table | |
def kmp(): | |
table = make_table() | |
j = 0 | |
for i in range(len(s)): | |
while j > 0 and s[i] != p[j]: | |
j = table[j - 1] | |
if s[i] == p[j]: | |
if j == len(p) - 1: | |
return True | |
else: | |
j += 1 | |
return False | |
def dpcopy(m): | |
return copy.deepcopy(m) | |
def sec_to_time(sec): | |
h = sec // 3600 | |
m = (sec % 3600) // 60 | |
s = sec % 60 | |
ans = [] | |
if h < 10: | |
ans.append(0) | |
ans.append(h) | |
ans.append(':') | |
if m < 10: | |
ans.append(0) | |
ans.append(m) | |
ans.append(':') | |
if s < 10: | |
ans.append(0) | |
ans.append(s) | |
string = ''.join(list(map(str, ans))) | |
return string | |
def time_to_sec(play_time): | |
h, m, s = map(int, play_time.split(":")) | |
sec = 3600 * h + 60 * m + s | |
return sec | |
def split2times(log): | |
s, e = log.split("-") | |
return (time_to_sec(s), time_to_sec(e)) | |
# ํญ์ ์๊ฐ์ min(๋๋ ์๊ฐ๋ค) - max(์์ ์๊ฐ๋ค ) | |
if __name__ == '__main__': | |
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
input = sys.stdin.readline | |
def get_parent(x): | |
if parent[x] == x: | |
return x | |
p = get_parent(parent[x]) | |
parent[x] = p | |
return p | |
def union(x, y): | |
x = get_parent(x) | |
y = get_parent(y) | |
if x != y: | |
parent[y] = x | |
def find_parent(x): | |
if parent[x] == x: | |
return x | |
return find_parent(parent[x]) | |
n, m = map(int, input().split()) | |
parent = {} | |
for i in range(n+1): | |
parent[i] = i | |
for _ in range(m): | |
z, x, y = map(int, input().split()) | |
if not z: | |
union(x, y) | |
if z: | |
if find_parent(x) == find_parent(y): | |
print('YES') | |
else: | |
print('NO') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment