This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "prison.h"
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
vvi devise_strategy(int N) {
int divisor = sqrt(N);
vvi report(N / divisor + divisor + 2, vi(N + 1));
report[0][0] = 0;
for (int i = 1; i <= N; i++) {
report[0][i] = i / divisor + 1;
}
for (int i = 1; i <= N / divisor + 1; i++) {
for (int j = 1; j <= N; j++) {
int total = j / divisor + 1;
if (i == total) {
report[i][j] = N / divisor + j % divisor + 2;
}
else {
report[i][j] = i < total ? -1 : -2;
}
}
report[i][0] = 1;
}
for (int i = N / divisor + 2; i <= N / divisor + divisor + 1; i++) {
for (int j = 1; j <= N; j++) {
int total = N / divisor + j % divisor + 2;
report[i][j] = total < i ? -1 : -2;
}
report[i][0] = 0;
}
return report;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |