Skip to content

Instantly share code, notes, and snippets.

View krrong's full-sized avatar

krrong

View GitHub Profile
@krrong
krrong / Quick Sort.cpp
Created December 19, 2021 15:14
quick sort
#include <iostream>
using namespace std;
int partition(int arr[], int left, int right) {
int pivot, tmp;
int low, high;
low = left + 1; // 좌측 끝(첫 번째 원소는 pivot)
high = right; // 우측 끝
pivot = arr[left]; // 기준
@krrong
krrong / BOJ 1012.cpp
Created January 3, 2022 05:58
유기농 배추
// https://www.acmicpc.net/problem/1012
#include <iostream>
#include <queue>
using namespace std;
int land[50][50];
bool visit[50][50];
int n, m, k;
// 하, 상, 좌, 우
@krrong
krrong / BOJ 1515.cpp
Created January 3, 2022 06:33
수 이어 쓰기
// https://www.acmicpc.net/problem/1515
#include <iostream>
#include <string>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
@krrong
krrong / BOJ 2606.cpp
Created January 10, 2022 04:04
바이러스
// https://www.acmicpc.net/problem/2606
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
vector<int> computers[101];
bool visit[101];
void bfs() {
@krrong
krrong / BOJ 1260.cpp
Created January 10, 2022 04:10
DFS와 BFS
// https://www.acmicpc.net/problem/1260
#include <iostream>
#include <queue>
#include <vector>
#include <stack>
using namespace std;
int n, m, v;
int graph[1001][1001];
bool visit[1001];
@krrong
krrong / BOJ 11725.cpp
Created January 10, 2022 04:12
트리의 부모 찾기
//https://www.acmicpc.net/problem/11725
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
int n;
vector<int> graph[100001]; // 그래프
bool visit[100001]; // 방문여부 저장
int parent[100001]; // 부모 노드값 저장
@krrong
krrong / BOJ 2178.cpp
Created January 10, 2022 04:24
미로 탐색
// https://www.acmicpc.net/problem/2178
#include <iostream>
#include <queue>
using namespace std;
int n, m;
int board[101][101]; // 미로
bool visit[101][101]; // 방문 여부
int dist[101][101]; // 거리
int dx[4] = { -1,1,0,0 };
@krrong
krrong / BOJ 2667.cpp
Created January 10, 2022 04:45
단지번호붙이기
// https://www.acmicpc.net/problem/2667
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
int n;
int board[26][26];
bool visit[26][26];
@krrong
krrong / BOJ 7576.cpp
Created January 10, 2022 06:02
토마토
// https://www.acmicpc.net/problem/7576
#include <iostream>
#include <queue>
using namespace std;
int tomato[1001][1001]; // 토마토 농장 상태
bool visit[1001][1001]; // 방문 여부 저장
int dist[1001][1001]; // 일 수 저장
int dx[4] = { -1,1,0,0 }; // x좌표 이동
int dy[4] = { 0,0,-1,1 }; // y좌표 이동
@krrong
krrong / BOJ 16918.cpp
Created January 16, 2022 05:37
봄버맨
// https://www.acmicpc.net/problem/16918
#include <iostream>
using namespace std;
char board[200][200];
int _time[200][200];
int dx[4] = { 0,0,-1,1 };
int dy[4] = { -1,1,0,0 };
int R, C, N;