# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
391226 | Andyvanh1 | Unscrambling a Messy Bug (IOI16_messy) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
using namespace std;
// 17.4.1.2 Headers
// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#include <"messy.h">
#define vt vector
#define pb push_back
typedef long long ll;
typedef vt<int> vi;
vi restore_permutation(int n , int w, int r){
string s = "";
string s1 = "";
for(int i = 0; i < n; i++){
s+="0";
s1+="1";
}
for(int i = 0; i < n; i++){
add_element(s1.substr(0,i+1)+s.substr(i+1));
}
compile_set();
vi p;
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
bool nh = false;
for(auto& e: p){
if(e==j){
nh = true;
break;
}
}
if(nh)continue;
bool bol = check_element(s.substr(0,j)+"1"+s.substr(j+1));
if(bol){
p.pb(j);
s = s.substr(0,j)+"1"+s.substr(j+1);
break;
}
}
}
return p;
}