Algorithm Study

Algorithm Study/python

[SWEA] (Python) 1954.달팽이 숫자

https://swexpertacademy.com/main/code/problem/problemDetail.do?problemLevel=3&contestProbId=AV5PobmqAPoDFAUq&categoryId=AV5PobmqAPoDFAUq&categoryType=CODE&problemTitle=&orderBy=FIRST_REG_DATETIME&selectCodeLang=ALL&select-1=3&pageSize=10&pageIndex=1 SW Expert Academy SW 프로그래밍 역량 강화에 도움이 되는 다양한 학습 컨텐츠를 확인하세요! swexpertacademy.com T = int(input()) dr = [0, 1, 0, -1] dc = [1, 0, -1, 0] for test_case..

Algorithm Study/백준

[C++] 백준 18352번 특정 거리의 도시 찾기

https://www.acmicpc.net/problem/18352 18352번: 특정 거리의 도시 찾기 첫째 줄에 도시의 개수 N, 도로의 개수 M, 거리 정보 K, 출발 도시의 번호 X가 주어진다. (2 ≤ N ≤ 300,000, 1 ≤ M ≤ 1,000,000, 1 ≤ K ≤ 300,000, 1 ≤ X ≤ N) 둘째 줄부터 M개의 줄에 걸쳐서 두 개 www.acmicpc.net #include using namespace std; int n, m, k, x; int d[300003]; vector v[300003]; // basic dijkstra form void dijk(int s) { d[s] = 0; queue q; q.push(s); while (!q.empty()) { int cur = ..

Algorithm Study/백준

[C++] LIS & DP / 백준 11053번 - 가장 긴 증가하는 부분 수열

https://www.acmicpc.net/problem/11053 11053번: 가장 긴 증가하는 부분 수열 수열 A가 주어졌을 때, 가장 긴 증가하는 부분 수열을 구하는 프로그램을 작성하시오. 예를 들어, 수열 A = {10, 20, 10, 30, 20, 50} 인 경우에 가장 긴 증가하는 부분 수열은 A = {10, 20, 10, 30, 20, 50} 이 www.acmicpc.net // Longest Increasing Subsequence #include using namespace std; int n; int A[1005]; int L1[1005]; vector Last; void LIS(int X[], in..

Algorithm Study/백준

[C++] Dijkstra algorithm / 백준 1504번 - 특정한 최단 경로

https://www.acmicpc.net/problem/1504 1504번: 특정한 최단 경로 첫째 줄에 정점의 개수 N과 간선의 개수 E가 주어진다. (2 ≤ N ≤ 800, 0 ≤ E ≤ 200,000) 둘째 줄부터 E개의 줄에 걸쳐서 세 개의 정수 a, b, c가 주어지는데, a번 정점에서 b번 정점까지 양방향 길이 존 www.acmicpc.net #include using namespace std; const int INF = 1e10; int n, e; int visited[1000]; int SL[1000]; int ST1[1000], ST2[1000]; class tpl { public: int a, b, l; }; vector ED[1000]; class pkt { public: int ..

Algorithm Study/백준

[C++] Dijkstra algorithm - 백준 1238번 파티

https://www.acmicpc.net/problem/1238 1238번: 파티 첫째 줄에 N(1 ≤ N ≤ 1,000), M(1 ≤ M ≤ 10,000), X가 공백으로 구분되어 입력된다. 두 번째 줄부터 M+1번째 줄까지 i번째 도로의 시작점, 끝점, 그리고 이 도로를 지나는데 필요한 소요시간 Ti가 들어 www.acmicpc.net #include using namespace std; int n, m, x; // shortest length int SL[1005]; // 돌아가는 길 int SB[1005]; int visited[1005]; class tpl { public: // a에서 b로 가는 노드. 길이는 l int a, b, l; }; class pkt { public: // a에서 b..

Algorithm Study/c++

[C++] Dijkstra Algorithm / codeforces-449-B

https://codeforces.com/contest/449/problem/B Problem - B - Codeforces codeforces.com #include using namespace std; class tpl { public: int b, w, isT; }; vector ED[300005]; long long SL[300005]; int ENU[300005]; int ELE[300005]; int visited[30005] = {0}; int n, m, k; class pkt { public: long long l; int a, b, w, isT; }; struct comp { bool operator()(pkt A, pkt B) { if (A.l > B.l) return true; els..

koreankdj
'Algorithm Study' 카테고리의 글 목록 (2 Page)