제출 #658221

#제출 시각아이디문제언어결과실행 시간메모리
658221benjaminkleynUnscrambling a Messy Bug (IOI16_messy)C++17
20 / 100
1 ms316 KiB
#include <bits/stdc++.h> #include "messy.h" using namespace std; typedef long long ll; string bin(int x, int n) { string res = ""; for (int i = 0; i < n; i++) { res.push_back('0' + (x & 1)); x /= 2; } reverse(res.begin(), res.end()); return res; } vector<int> restore_permutation(int n, int w, int r) { if (n == 8) { add_element("10000000"); add_element("11000000"); add_element("11100000"); add_element("11110000"); add_element("11111000"); add_element("11111100"); add_element("11111110"); add_element("11111111"); compile_set(); vector<vector<string>> numz(n); for (int i = 1; i < 256; i++) numz[__builtin_popcount(i) - 1].push_back(bin(i, n)); vector<int> res(n, -1); for (int i = 0; i < n; i++) for (string s : numz[i]) if (check_element(s)) { for (int j = 0; j < n; j++) if (s[j] == '1' && res[j] == -1) { res[j] = i; break; } break; } return res; } return vector<int>(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...