분류 전체보기
-
python list initialization카테고리 없음 2023. 1. 4. 17:38
for _ in range(n): lis.append(0) 대신 lis = [0]*10 쓰셈 which is more efficient initializing list with 0s and then populating vs directly appending items to list I saw two versions of the same code and wanted to know which one is efficiently better and which one is more frequently used in python. output_list = [0 for _ in range(output_length)] k=0 for i in... stackoverflow.com
-
python template아무거나적어~ 2023. 1. 3. 21:40
1 2 3 4 5 6 7 8 9 10 11 import sys from collections import defaultdict as dd from bisect import bisect_left as lower_bound, bisect_right as upper_bound from functools import cmp_to_key from collections import deque import os.path if os.path.isfile("input.txt"): sys.stdin = open('input.txt') sys.stdout = open('output.txt', 'w') input = sys.stdin.readlinecs
-
-
수열 규칙 찾아주는 사이트아무거나적어~ 2022. 12. 23. 14:46
The On-Line Encyclopedia of Integer Sequences® (OEIS®) Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 59th year, we have over 358,000 sequences, and we’ve crossed 10,300 citations (which often say “discovered than oeis.org
-
[c++] dp 캐싱할때 절대 나오지 않는걸로 초기화해야함실수모음 2022. 12. 23. 14:44
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 #include #define endl "\n" // don't use when you cover interactive problem #define all(v) (v).begin(), (v).end() using namespace std; typedef long long ll; typedef pair pi; typedef pair pl; ll m; l..
-
[c++] 실수 & 코너케이스(수정 24.03.26.)실수모음 2022. 12. 22. 16:46
맞왜틀인경우 일단 문제를 다시 읽어보자 코너 케이스가 될 수 있는 경우 입력 데이터의 최대, 최소 ex) https://cses.fi/problemset/task/1194/ n, m 이 모두 1 ex) 0 이 들어갈 때 ex) 그래프에서 루트만 주어지는 경우 뭔가가 없어도 되는 경우 ex) https://cses.fi/problemset/task/1194/ 몬스터가 없는 경우 trivial case(코드 돌릴필요 없이 바로 끝나는 경우) ex) https://cses.fi/problemset/task/1194/ A가 처음부터 가장자리에 있는 경우 ex) https://cses.fi/problemset/task/1746/ 빈칸을 채우기 전에 조건에 위배되는 경우 이동이 주어진 격자점 밖에서 이루어질 수 있..