Skip to content

Instantly share code, notes, and snippets.

View baactree's full-sized avatar

Seonjun Park baactree

View GitHub Profile
#include <bits/stdc++.h>
using namespace std;
#define MAX 30000
int base[MAX], diff[MAX], sum[MAX], ss[MAX];
bool chk[MAX];
vector<int> mp[MAX];
pair<int, int> vec[MAX];
int get_idx(int x) {
#include <bits/stdc++.h>
using namespace std;
#define MAX 30000
int base[MAX], diff[MAX];
bool chk[MAX];
pair<int, int> vec[MAX];
void flip(int mat[4][4]) {
for (int i = 0; i < 4; i++) {
void dfs(int now, int par){
cnt[now]=col[now];
for(int i=0;i<adj[now].size();i++){
int there=adj[now][i];
if(there==par)
continue;
dfs(there, now);
cnt[now]+=cnt[there];
}
dp[now][col[now]]=1;
// =====================================================================================
//
// Filename: a.cpp
// Created: 2017년 06월 08일 17시 44분 55초
// Compiler: g++ -O2 -std=c++14
// Author: baactree , bsj0206@naver.com
// Company: Chonnam National University
//
// =====================================================================================
#include <bits/stdc++.h>
using namespace std;
map<pair<int, int>, int> mp;
int solve(int b, int g){
if(b>=40)
return 0;
if(g==1)
return b==0;
if(g<=1)
return 0;
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int k;
vector<int> arr;
int in;
scanf("%d", &k);
while(scanf("%d", &in)!=EOF)
import java.util.concurrent.Semaphore;
import java.util.concurrent.ThreadLocalRandom;
public class Main {
static Philosopher philosophers[] = new Philosopher[5];
static Chopsticks chopsticks[] = new Chopsticks[5];
static class Chopsticks {
private Semaphore mutex = new Semaphore(1);
import java.util.concurrent.ThreadLocalRandom;
public class Main {
public static void main(String[] args) {
Philosopher[] philosophers = new Philosopher[5];
PhilosopherMonitor monitor = new PhilosopherMonitor(5);
for (int i = 0; i 5; i++) {
philosophers[i] = new Philosopher(i, monitor);
#include "bits/stdc++.h"
using namespace std;
int N;
bool Map[2187][2187];
void search(int x, int y, int k) {
if (k == 1) {
Map[x][y] = true;
return;
}
int t = k / 3;
//n!을 구하는 함수(반복문)
int fact(int n) {
int ret = 1;
for (int i = 1; i <= n; i++)
ret *= i;
return ret;
}
//n!을 구하는 함수(재귀 호출)
int fact_recursive(int n) {
//n이 0이면 더이상 쪼개지지 않는다. (기저 사례)