# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1210839 | Nicolaikrob | 죄수들의 도전 (IOI22_prison) | C++17 | 1 ms | 580 KiB |
#include "prison.h"
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> devise_strategy(int n) {
vector<vector<int>> S;
vector<int> TP(n+1, 0);
TP[0] = 1;
TP[1] = -1-TP[0];
TP[n] = -2+TP[0];
for(int j = 2; j < 2+(n-2)/2; j++) TP[j] = 1<<1;
for(int j = 2+(n-2)/2; j < n; j++) TP[j] = (1<<1)+1;
S.push_back(TP);
int p, rs = 2;
for(int x = 1; rs > 1; x++) {
p = (x>>1)+1;
TP[0] = p&1;
rs = n;
for(int i = 0; i < p-2; i++) rs = (rs+1)>>1;
if(rs == 1) return S;
for(int k = 0; k*rs < n; k++) {
int l = k*rs+1, u = (k+1)*rs, m = l+rs/2;
if(x&1) {
for(int j = l; j <= m; j++) TP[j] = -1-TP[0];
for(int j = m+1; j < m+1+(u-m-1)/2; j++) TP[j] = (p<<1);
for(int j = m+1+(u-m-1)/2; j < u-1; j++) TP[j] = (p<<1)+1;
TP[u] = -2+TP[0];
}
else {
TP[l] = -1-TP[0];
for(int j = l+1; j < l+1+(m-l+1)/2; j++) TP[j] = (p<<1);
for(int j = l+1+(m-l+1)/2; j < m; j++) TP[j] = (p<<1)+1;
for(int j = m; j <= u; j++) TP[j] = -2+TP[0];
}
}
S.push_back(TP);
}
// for(int i = 0; i < n+1; i++) {
// for(int j = 0; j < S.size(); j++) {
// cout << S[j][n-i] << ' ';
// }
// cout << endl;
// }
// return S;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |