| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1055873 | vjudge1 | 죄수들의 도전 (IOI22_prison) | C++17 | 7 ms | 1372 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "prison.h"
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using ii = pair<int, int>;
vector<vi> expand(vector<vi> S, int a, int nr, int tip) {
for(auto &lin : S) {
lin[0] ^= 1;
for(int i = 1; i < int(lin.size()); ++i) {
if(lin[i] < 0) lin[i] = -3 - lin[i];
else lin[i] += nr;
}
}
int lenS = int(S.size());
vector<vi> Re(int(S.size()) + nr, vi(nr * a + 3, -1));
for(int i = 1; i < lenS; ++i) {
//Re[i + nr]
Re[i + nr][0] = S[i][0];
for(int d = 0; d < nr; ++d) {
for(int j = 1; j <= a; ++j) {
Re[i + nr][d * a + j + 1] = S[i][j]; /// se repeta
}
}
}
for(int i = 1; i <= nr; ++i) {
///Re[i] -> 2 + (i - 1) * a ... 1 + i * a
Re[i][0] = 1;
for(int j = 1; j < (i - 1) * a + 2; ++j) {
Re[i][j] = -2;
}
for(int j = (i - 1) * a + 2; j <= 1 + i * a; ++j) {
Re[i][j] = S[0][(j - 2) % a + 1];
}
for(int j = 1 + i * a + 1; j < Re[i].size(); ++j) {
Re[i][j] = -1;
}
}
Re[0][0] = 0;
Re[0][1] = -1;
Re[0].back() = -2;
for(int d = 1; d <= nr; ++d) {
for(int i = (d - 1) * a + 2; i <= d * a + 1; ++i) {
Re[0][i] = d;
}
}
return Re;
}
vector<vi> devise_strategy(int n) {
vi Ord = {2, 3, 3, 3, 3, 3, 3};
vector<vi> S = {vi{0, -1, -2}};
int a = 2;
int tip = 1;
for(auto it : Ord) {
S = expand(S, a, it, tip);
tip ^= 1;
a = it * a + 2;
// cout << S[0].size() << " " << a << "\n";
}
// cerr << S.size() << " " << S[1].size() << "\n";
for(int i = 0; i < S.size(); ++i)
S[i].resize(n + 1);
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... | ||||
