제출 #828191

#제출 시각아이디문제언어결과실행 시간메모리
828191caganyanmazUnscrambling a Messy Bug (IOI16_messy)C++14
38 / 100
1 ms340 KiB
#include <bits/stdc++.h> #include <vector> using namespace std; #ifdef DEBUGGING #include "../debug.h" #else #define debug(x...) void(42) #endif #include "messy.h" vector<int> restore_permutation(int n, int w, int r) { for (int i = 0; i < n-1; i++) { string s(n, '0'); for (int j = 0; j <= i; j++) s[j] = '1'; for (int j = i+1; j < n; j++) s[j] = '0'; add_element(s); } compile_set(); vector<int> p(n); set<int> av; for (int i = 0; i < n; i++) av.insert(i); string current(n, '0'); for (int i = 0; i < n; i++) current[i] = '0'; for (int i = 0; i < n-1; i++) { int j; bool found = false; for (auto it = av.begin(); !found && it != av.end(); it++) { j = *it; current[j] = '1'; debug(j, current.c_str()); if (check_element(current)) { found = true; break; } current[j] = '0'; } assert(found); p[j] = i; av.erase(j); } assert(av.size() == 1); p[*av.begin()] = n-1; return p; }
#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...