#include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair pii; int dx[] = {0 , 0 , 1 , -1}; int dy[] = {1 , -1 , 0 , 0}; int n , q; int arr[50005]; int tree[50005 * 2]; int mn = 0; inline int Max(int a, int b){ return a>b ? a : b; } void build (int now, int s, int e){ if (s == e){ tree[now] = arr[s]; return; ..
#include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long ull; typedef pair pii; typedef signed char i8; typedef short i16; typedef int i32; typedef long long i64; int dx[] = {0, 0, 1, -1}; int dy[] = {1, -1, 0, 0}; int n; string str; // 나중에 track 할때 다른 데이터가 필요 할 수 있으니까 우선 Struct로... struct ..
#include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long ull; typedef pair pii; typedef signed char i8; typedef short i16; typedef int i32; typedef long long i64; int dx[] = {0, 0, 1, -1}; int dy[] = {1, -1, 0, 0}; string str; /* dp? "at" or "gc" = correct dna "a??t" or "g??c" = correct dna..
#include using namespace std; int main(){ int n; queue st; cin >> n; while(n--){ char x; cin >> x; if(x == 'i'){ int g; cin >> g; st.push(g); } if(x == 'c'){ cout
#include using namespace std; int n = 0; int danzi = 0; class cell { public: int y; int x; cell(int _y, int _x) { y = _y; x = _x; } }; int main() { cin >> n; int M[25][25]; memset(M, 0, sizeof M); vector cnt; // count. for (int y = 0; y > c; if (c == '0') M[y][x] = 0; else M[y][x] = 1; } } for (int y = 0; y < n; y++) { for (int x = 0; x < n;..
#include using namespace std; typedef long long ll; typedef pair pii; // global varable int n; // cost[from][to] = COST int cost[15][15]; // for go function bool visited[15]; int nowCost = 0; int leftSpot = 0; int minCost = 2100000000; void go(int where){ if(leftSpot == 0){ if(cost[where][0] > n; leftSpot = n - 1; for(int i = 0;i > cost[i][j]; } } visited..
#include using namespace std; typedef long long ll; typedef pair pii; /* 2^(n^2) 다른색 끼리는 영향이 없음 -> 다른색은 볼 필요가 없음 -> 개별적으로 계산 가능 -> 판이 판 / 2 가됨..? */ int n; // usedRTL[x + n - y - 1] = T | F bool usedRTL[30]; // usedLTR[n - x - 1 + n - y - 1] = T | F bool usedLTR[30]; // placeAbles[idx] = {y , x}; vector placeAbles; vector placeAblesBl; // R to L fomu :x + n - y - 1 // L to R fomu : n - x - 1 + n..
#include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long ull; typedef pair pii; typedef uint16_t cint; int dx[] = {0, 0, 1, -1}; int dy[] = {1, -1, 0, 0}; cint needLiter[1005][1005]; cint n; // 급유지 cint k; // 최대 연료 충전 수 struct Pos { cint x; cint y; }; vector poses; int calc_dist(cint x, cint y, cint..
#include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair pii; int dx[] = {0 , 0 , 1 , -1}; int dy[] = {1 , -1 , 0 , 0}; int n , m; struct MAX{ int arr[50005]; int tree[50005 * 4]; int etd = -1; inline int Max(int a, int b){ return a > b ? a : b; } void build (int now, int s, int e){ if (s == e){ tree[now] = ..