본문 바로가기

분류 전체보기

(131)
면접[그래픽스] 보호되어 있는 글입니다.
면접[언어] 보호되어 있는 글입니다.
면접[NetWork] 보호되어 있는 글입니다.
면접[OS] 보호되어 있는 글입니다.
2-5. 최대 선호 음식(DFS, 비트연산) ★★★★★ #include #include using namespace std; int n, d, k; int ch[16]; bool flag = false; int cnt = 0, res = 0; vector V[30001]; void DFS(int L, int s) { if(L == k) { for(int i = 1; i k) continue; for(int j = 0; j n >> d >> k; int a, b; for(int i =..
2-4. 숲속의 기사 ★★★★☆ #include #include #include using namespace std; struct Pos { int x; int y; Pos(int x, int y) { this -> x = x; this -> y = y; } }; int dis[2][1001][1001]; int main() { int w, h, res = 2147000000; cin >> w >> h; int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; queue Q1; queue Q2; vector Map(h, vector(w, 0)); for(int i = 0; i > Map[i][j]; if(Map[i]..
2-3. 멀티태스킹(효율성) ★★★★☆ #include #include #include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); long long n, k; cin >> n; vector T(n+1, 0); vector ST(n+1, 0); for(int i = 1; i > T[i]; ST[i] = T[i]; } cin >> k; sort(ST.begin(), ST.end()); long long rest = n; for(int i = 1; i = cycle) { k -= cycle; rest--; } else { int cnt = k % rest; int pos = 0; for(int j = 1; j = ST[i]) { if(cnt == p..
2-2. 모든 아나그램 (해쉬, 슬라이딩 윈도우) ★★★☆☆ #include #include using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); string s; string t; map ana; map tmp; cin >> s >> t; int count = 0; int lt = 0, rt = t.size()-1; for(int i = 0; i < t.size(); i++) ana[t[i]]++; for(int i = 0; i < rt; i++) tmp[s[i]]++; for(int rt = t.size()-1 ; rt < s.size(); rt++) { tmp[s[rt]]++; if(ana == tmp) count++; tmp[s[lt]]--; if(tmp[s[lt]] ..