Submission #246149

#TimeUsernameProblemLanguageResultExecution timeMemory
246149LittleFlowers__Unscrambling a Messy Bug (IOI16_messy)C++17
20 / 100
6 ms384 KiB
#include <bits/stdc++.h> using namespace std; #define in ({int x=0;int c=getchar(),n=0;for(;!isdigit(c);c=getchar()) n=(c=='-');for(;isdigit(c);c=getchar()) x=x*10+c-'0';n?-x:x;}) mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int rnd(int l,int r){return l+rng()%(r-l+1);} #define fasty ios_base::sync_with_stdio(0),cin.tie(0); #define forinc(a,b,c) for(int a=b,_c=c;a<=_c;++a) #define fordec(a,b,c) for(int a=b,_c=c;a>=_c;--a) #define forv(a,b) for(auto&a:b) #define fi first #define se second #define pb push_back #define ii pair<int,int> #define mt make_tuple #define all(a) a.begin(),a.end() #define reset(f, x) memset(f, x, sizeof(f)) #define gg exit(0); #include "messy.h" vector<int> restore_permutation(int n,int w,int r){ string s; forinc(i,1,n) s+="0"; forinc(i,1,n){ s[i-1]='1'; add_element(s); } vector<int> val(n); iota(all(val),1); shuffle(all(val),rng); compile_set(); vector<int> pos(n), dd(n); s.clear(); forinc(i,1,n) s+="0"; forinc(i,1,n){ forv(j,val) if(!dd[j-1]){ s[j-1]='1'; r--; if(r<0) exit(-1); if(check_element(s)){ pos[i-1]=j-1; dd[j-1]=1; break; } s[j-1]='0'; } } return pos; }
#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...