Submission #719104

#TimeUsernameProblemLanguageResultExecution timeMemory
719104mathematikPrisoner Challenge (IOI22_prison)C++17
90 / 100
10 ms1364 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; vector<vector<int>> erg; void fill2(int s, int e, int o, int d, bool bagB) { } void fill(int s, int e, int o, int d, bool bagB) { if (d == 8) { fill2(s, e, o, d, bagB); return; } erg[o][0] = bagB; if (s >= e) return; int pickThis = -1 - bagB; int pickOther = -2 + bagB; erg[o][s] = pickThis; erg[o][e] = pickOther; if (d < 7) for (int i = 1; i <= 3; i++) { erg[d * 3 + i][s] = pickOther; erg[d * 3 + i][e] = pickThis; } int t0 = s + 1; int t3 = e; int t1 = (t0 + t0 + t3) / 3; int t2 = (t0 + t3 + t3) / 3; for (int i = t0; i < t1; i++) { erg[o][i] = d * 3 + 1; } for (int i = t1; i < t3; i++) { erg[d * 3 + 1][i] = pickThis; } for (int i = t0; i < t1; i++) { erg[d * 3 + 2][i] = pickOther; } for (int i = t1; i < t2; i++) { erg[o][i] = d * 3 + 2; } for (int i = t2; i < t3; i++) { erg[d * 3 + 2][i] = pickThis; } for (int i = t0; i < t2; i++) { erg[d * 3 + 3][i] = pickOther; } for (int i = t2; i < t3; i++) { erg[o][i] = d * 3 + 3; } fill(t0, t1 - 1, d * 3 + 1, d + 1, !bagB); fill(t1, t2 - 1, d * 3 + 2, d + 1, !bagB); fill(t2, t3 - 1, d * 3 + 3, d + 1, !bagB); } vector<vector<int>> devise_strategy(int N) { erg = vector<vector<int>>(22, vector<int>(N + 1)); fill(1, N, 0, 0, true); return erg; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...