제출 #593352

#제출 시각아이디문제언어결과실행 시간메모리
593352skittles1412Unscrambling a Messy Bug (IOI16_messy)C++17
38 / 100
1 ms340 KiB
#include "bits/extc++.h" using namespace std; template <typename T> void dbgh(const T& t) { cerr << t << endl; } template <typename T, typename... U> void dbgh(const T& t, const U&... u) { cerr << t << " | "; dbgh(u...); } #ifdef DEBUG #define dbg(...) \ cerr << "L" << __LINE__ << " [" << #__VA_ARGS__ << "]: "; \ dbgh(__VA_ARGS__); #else #define dbg(...) #define cerr \ if (false) \ cerr #endif #define endl "\n" #define long int64_t #define sz(x) int((x).size()) void add_element(string x); bool check_element(string x); void compile_set(); vector<int> restore_permutation(int n, int, int) { mt19937 cowng(chrono::steady_clock::now().time_since_epoch().count()); for (int i = 1; i <= n; i++) { add_element(string(i, '1') + string(n - i, '0')); } compile_set(); string cur(n, '0'); vector<int> ans; for (int i = 0; i < n; i++) { vector<int> left; bool vis[n] {}; for (auto& a : ans) { vis[a] = true; } for (int j = 0; j < n; j++) { if (!vis[j]) { left.push_back(j); } } shuffle(begin(left), end(left), cowng); for (auto& a : left) { cur[a] = '1'; if (check_element(cur)) { ans.push_back(a); break; } cur[a] = '0'; } } vector<int> tmp(n); for (int i = 0; i < n; i++) { tmp[ans[i]] = i; } return tmp; }
#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...