제출 #626680

#제출 시각아이디문제언어결과실행 시간메모리
626680flashmt죄수들의 도전 (IOI22_prison)C++17
0 / 100
1 ms212 KiB
#include <bits/stdc++.h> using namespace std; const int BASE = 3; const int POWER = 8; // 3 ** 8 = 6561 vector<vector<int>> devise_strategy(int n) { vector<vector<int>> ans; vector<vector<int>> digits(n); for (int i = 0; i < n; i++) { for (int j = 0, x = i; j < POWER; j++) { digits[i].push_back(x % BASE); x /= BASE; } reverse(begin(digits[i]), end(digits[i])); } { vector<int> a = {0}; for (int j = 0; j < n; j++) a.push_back(digits[j][0] + 1); ans.push_back(a); } for (int i = 0; i < POWER; i++) for (int x = 0; x < BASE; x++) { int otherBag = i % 2, curBag = otherBag ^ 1; vector<int> a = {curBag}; for (int j = 0; j < n; j++) if (digits[j][i] < x) a.push_back(-curBag - 1); else if (digits[j][i] > x) a.push_back(-otherBag - 1); else a.push_back(digits[j][i + 1]); ans.push_back(a); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...