#include "messy.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pi pair<int, int>
#define pl pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(),(x).end()
vi restore_permutation(int n, int w, int r) {
string s(n,'0');
for (int i=0; i<n-1; i++) {
s[i]='1';
add_element(s);
}
compile_set();
vector<string> has;
for (int i=1; i<(1<<n)-1; i++) {
string s;
int t=i;
for (int j=0; j<n; j++) {
s+=char('0'+(t%2));
t>>=1;
}
if (check_element(s)) {
has.pb(s);
}
}
sort(all(has),[](string& a, string& b){return count(all(a),'1')<count(all(b),'1');});
vi resp(n,n-1);
string rem(n,'0');
for (int i=0; i<n-1; i++) {
for (int j=0; j<n; j++) {
if (rem[j]=='0' && has[i][j]=='1') {
rem[j]='1';
resp[j]=i;
break;
}
}
}
return resp;
}
Compilation message (stderr)
messy.h:1:9: warning: #pragma once in main file
1 | #pragma once
| ^~~~
messy_c.h:1:9: warning: #pragma once in main file
1 | #pragma once
| ^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |