제출 #84017

#제출 시각아이디문제언어결과실행 시간메모리
84017Alexa2001Unscrambling a Messy Bug (IOI16_messy)C++17
100 / 100
7 ms640 KiB
#include <bits/stdc++.h> #include "messy.h" using namespace std; inline int last(int x) { return (1<<x) - 1; } vector<int> restore_permutation(int n, int w, int r) { int i, j, l, k; string s; vector<int> v[10][200]; for(l=1; (1<<l) < n; ++l); for(i=0; i<l; ++i) for(j=0; j<n; ++j) if( (j & (1<<i)) == 0 ) { s.clear(); for(k=0; k<n; ++k) if((k & last(i)) != (j & last(i))) s.push_back('1'); else if(k == j) s.push_back('1'); else s.push_back('0'); add_element(s); } compile_set(); for(i=0; i<n; ++i) v[0][0].push_back(i); for(i=0; i<l; ++i) { for(j=0; j<=last(i); ++j) { s.clear(); for(k=0; k<n; ++k) s.push_back('0'); for(k=0; k<=last(i); ++k) if(k != j) for(auto it : v[i][k]) s[it] = '1'; for(auto val : v[i][j]) { s[val] = '1'; if(check_element(s)) v[i+1][j].push_back(val); else v[i+1][j + (1<<i)].push_back(val); s[val] = '0'; } } } vector<int> where(n), ans(n); for(i=0; i<n; ++i) where[i] = v[l][i][0]; for(i=0; i<n; ++i) ans[where[i]] = i; return ans; }
#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...