제출 #1008437

#제출 시각아이디문제언어결과실행 시간메모리
1008437Unlucky죄수들의 도전 (IOI22_prison)C++17
65 / 100
9 ms1116 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; vector<vector<int>> devise_strategy(int N) { vector<vector<int>> ret(25, vector<int>(N+1)); for (int i = 24; i > 12; i-=2){ ret[i][0] = 1; ret[i-12][0] = 1; } for (int i = 1; i <= N; i++){ if (i & (1 << 12)) { ret[0][i] = 24; } else { ret[0][i] = 12; } } for (int e = 12; e > 1; e--){ for (int i = 1; i <= N; i++){ if (i & (1 << (e))){ ret[e][i] = -2+ret[e][0]; } else if (i & (1 << (e-1))) { ret[e][i] = e+11; } else { ret[e][i] = e-1; } if (!(i & (1 << (e)))){ ret[e+12][i] = -1-ret[e][0]; } else if (i & (1 << (e-1))) { ret[e+12][i] = e+11; } else { ret[e+12][i] = e-1; } } } int e = 1; for (int i = 1; i <= N; i++){ if (i & (1 << (e))){ ret[e][i] = -2+ret[e][0]; } else if (i & (1 << (e-1))) { ret[e][i] = -2+ret[e][0]; } else { ret[e][i] = -1-ret[e][0]; } if (!(i & (1 << (e)))){ ret[e+12][i] = -1-ret[e][0]; } else if (i & (1 << (e-1))) { ret[e+12][i] = -2+ret[e][0]; } else { ret[e+12][i] = -1-ret[e][0]; } } return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...