Submission #1225784

#TimeUsernameProblemLanguageResultExecution timeMemory
1225784the_coding_poohPrisoner Challenge (IOI22_prison)C++20
51.50 / 100
10 ms1608 KiB
#include "prison.h" #include <bits/stdc++.h> #define uwu return using namespace std; #define fs first #define sc second #define all(x) x.begin(), x.end() void output(long long a, bool b){ if(b) cerr << '\n'; else cerr << a << ' '; return; } map <int, pair<int, int>> mp; map <pair<int, int>, int> un_mp; vector <int> magic; void init(){ mp[29] = {0, 1}; mp[1] = {0, 2}; mp[2] = {1, 0}; mp[3] = {1, 1}; mp[4] = {1, 2}; mp[5] = {2, 0}; mp[6] = {2, 1}; mp[7] = {2, 2}; mp[8] = {3, 0}; mp[9] = {3, 1}; mp[10] = {3, 2}; mp[11] = {4, 0}; mp[12] = {4, 1}; mp[13] = {4, 2}; mp[14] = {4, 3}; mp[15] = {5, 0}; mp[16] = {5, 1}; mp[17] = {5, 2}; mp[18] = {5, 3}; mp[19] = {6, 0}; mp[20] = {6, 1}; mp[21] = {6, 2}; mp[22] = {6, 3}; mp[0] = {7, 7}; mp[23] = {7, 6}; mp[24] = {7, 5}; mp[25] = {7, 4}; mp[26] = {7, 3}; mp[27] = {7, 2}; mp[28] = {7, 1}; magic = {1, 3, 9, 27, 81, 324, 1296, 5184}; for(auto i:mp){ un_mp[i.sc] = i.fs; } un_mp[{0, 0}] = -1; un_mp[{7, 0}] = -1; uwu; } vector<vector<int>> devise_strategy(int N) { init(); vector<vector<int>> ret; for (int i = 0; i <= 29; i++){ if(mp[i].fs == 7){ ret.push_back({0}); int lv = mp[i].sc - 1; for (int j = 1; j <= N; j++){ ret.back().push_back(un_mp[{lv, (j % magic[lv + 1]) / magic[lv]}]); } } else{ ret.push_back({1}); int lv = mp[i].fs; for (int j = 1; j <= N; j++){ int tmp = (j % magic[lv + 1]) / magic[lv]; if(mp[i].sc == tmp){ ret.back().push_back(un_mp[{7, lv}]); } else{ if(mp[i].sc < tmp) ret.back().push_back(-1); else ret.back().push_back(-2); } } } } return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...