목록STL (29)
Deep Learning study
#include using namespace std; #define FOR(i,a,b) for(int i=a ; ib ; i--) int x[4] = {0,0,1,-1}; int y[4] = {1,-1,0,0}; int R,C,T,r1,r2,r[2],m[51][51],v[51][51]; bool check(int x, int y){ return (x=0 && y=0); } void proliferation(int a, int b){ int cnt=0,prol = m[a][b]/5; FOR(i,0,4){ int nx = a + x[i], ny = b + y[i]; if(check(nx,ny) && m[nx][ny]!=-1) cnt++; } m[a][b] = m[a][b] - prol * cnt; v[a][..
#include using namespace std; #define FOR(i,a,b) for(int i=a ; i
#include using namespace std; #define x first #define y second #define FOR(i,a,b) for(int i=a ; i=0 && b =0 && board[a][b] != 2; } bool move(int nxt){ a += gox[cur_dir%4], b+= goy[cur_dir%4]; if(!check()) return false; snake.push(make_pair(a,b)); if(board[a][b] == 0){ pair tmp = snake.front(); board[tmp.x][tmp.y] = 0; snake.pop(); } board[a][b] = 2; if(nxt == 'L') cur_dir += 3; else if..
#include using namespace std; #define FOR(i,a,b) for(int i=a ; i=0 && a=0 && b > N >> M; FOR(i,0,N) FOR(j,0,M) cin >> A[i][j]; FOR(i,0,N) FOR(j,0,M){ dfs(i,j,1,A[i][j]); ex(i,j); } cout
#include using namespace std; #define FOR(i,a,b) for(int i=a ; i> N >> M >> x >> y >> K; FOR(i,0,N) FOR(j,0,M) cin >> MAP[i][j]; FOR(i,0,K) cin >> order[i]; FOR(i,0,K){ int ord = order[i]; if(ord == 1){ if(y+1>=M) continue; else{ ++y; dice[2] = dice[0]; dice[0] = dice[3]; dice[3] = 7-dice[2]; } }else if(ord == 2){ if(y-1 < 0) continue; else{ --y; dice[3] = dice[0]; dice[0] = dice[2]; dice[2] = 7..
#include using namespace std; #define FOR(i,a,b) for(int i=a ; i> N; FOR(i,1,N+1) cin >> T[i] >> P[i]; FOR(i,1,N+2) FOR(j,1,i) if(T[i-j] - j
#include using namespace std; #define FOR(i,a,b) for(int i = a; i=b; i--) #define x first #define y second int board[16][16],pos[3],tmp[16][16],N,M,D,ANS; int dist(int a, int b, int c, int d){ return abs(a-c) + abs(b-d); } void update(){ FOR_(i,N-1,1) FOR(j,0,M) board[i][j] = board[i-1][j]; FOR(j,0,M) board[0][j] = 0; } int attack(){ int min[3] = {99,99,99}; vector co(3); FOR(i,0,3) co[i].x = 99..
#include using namespace std; int main(){ ios_base::sync_with_stdio(false); int t; cin >> t; for(int T = 1 ; T > m >> c >> i; char C[100010] = {0,}, I[5000] = {0,}; cin >> C >> I; int point = 0, input_p = 0,cnt = 0; char mem[100010] = {0,}; int brack[100010] = {0,},min_loop_idx = 0, max_loop_idx = 0; stack bracket; for(int i=0 ;i< c ; i++){ if(C[i] == '[') bracket.push(i); else if(C[i]==']'){ br..