Submission #849053

#TimeUsernameProblemLanguageResultExecution timeMemory
849053grossly_overconfidentPrisoner Challenge (IOI22_prison)C++17
0 / 100
1 ms600 KiB
#include <bits/stdc++.h> using namespace std; int find_digit(int a, int i){ string k = to_string(a); while (k.size() < 4){ k = "0" + k; } return k[i] - 48; } vector<vector<int>> devise_strategy(int n){ int x = 35; vector<vector<int>> out(x, vector<int>(n + 1, 0)); for (int i = 1; i < n; ++i){ out[0][i] = find_digit(i, 0) + 1; out[0][n] = -2; } for (int i = 1; i <= 5; ++i){ out[i][0] = 1; for (int j = 1; j <= n; ++j){ int k = find_digit(j, 0); if (k > i - 1){ out[i][j] = -1; continue; } if (k < i - 1){ out[i][j] = -2; continue; } out[i][j] = 6 + find_digit(j, 1); } } for (int i = 6; i <= 15; ++i){ out[i][0] = 0; for (int j = 1; j <= n; ++j){ int k = find_digit(j, 1); if (k > i - 6){ out[i][j] = -2; continue; } if (k < i - 6){ out[i][j] = -1; continue; } out[i][j] = 16 + find_digit(j, 2); } } for (int i = 16; i <= 25; ++i){ out[i][0] = 1; for (int j = 1; j <= n; ++j){ int k = find_digit(j, 2); if (k > i - 16){ out[i][j] = -1; continue; } if (k < i - 16){ out[i][j] = -2; continue; } out[i][j] = 26 + find_digit(j, 3); } } for (int i = 26; i <= 35; ++i){ out[i][0] = 0; for (int j = 1; j <= n; ++j){ int k = find_digit(j, 3); if (k > i - 26){ out[i][j] = -2; continue; } if (k < i - 26){ out[i][j] = -1; continue; } } } for (int i = 0; i < x; ++i){ for (int j = 0; j < n + 1; ++j){ if (out[i][j] < -2){ out[i][j] = 0; } } } return out; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...