#include <vector>
#include "messy.h"
#include <bits/stdc++.h>
#define REP(v, i, j) for (int v = i; v != j; v++)
#define FORI(v) for (auto i : v)
#define FORJ(v) for (auto j : v)
#define OUT(v, a) \
FORI(v) \
cout << i << a;
#define OUTS(v, a, b) \
cout << v.size() << a; \
OUT(v, b)
#define in(a, n) \
REP(i, 0, n) \
cin >> a[i];
#define SORT(v) sort(begin(v), end(v))
#define REV(v) reverse(begin(v), end(v))
#define MEMSET(m) memset(m, -1, sizeof m)
#define pb push_back
#define fi first
#define se second
#define detachIO \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
using namespace std;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<pii, pii> piiii;
std::vector<int> restore_permutation(int n, int w, int r) {
const int LOGN=5;
vector<string> num;
REP(i,0,n){
num.pb("");
REP(j,0,LOGN){
if(i&(1<<j))num.back().pb('1');
else num.back().pb('0');
}
}
REP(i,0,LOGN){
string s;
REP(_,0,LOGN-i-1)s.pb('0');
REP(_,0,i+1)s.pb('1');
num.erase(find(num.begin(),num.end(),s));
REP(_,0,n-LOGN)s.pb('0');
add_element(s);
// cerr<<s<<endl;
}
REP(i,LOGN,n){
string s;
REP(j,0,LOGN){
s.pb('0');
}
REP(_,LOGN,n)s.pb('0');
s[i]='1';
REP(x,0,LOGN){
s[x]=num[i-LOGN][x];
s[i]='0';
if(s.find('1')==s.npos){s[i]='1';continue;}
s[i]='1';
// cerr<<s<<endl;
add_element(s);
}
}
compile_set();
string prev;
REP(i,0,n)prev.pb('0');
vector<int> ans;
vector<int> e;
ans.resize(n,-1);
REP(i,0,LOGN){
REP(j,0,n){
if(prev[j]=='1')continue;
prev[j]='1';
if(check_element(prev)){ans[j]=LOGN-i-1,e.pb(j);break;}
prev[j]='0';
}
}
REV(e);
// cerr<<endl;
REP(i,0,n){
if(ans[i]!=-1)continue;
string s;
REP(_,0,n)s.pb('0');
s[i]='1';
string str;
FORJ(e){
s[j]='1';
if(check_element(s))str.pb('1');
else str.pb('0'),s[j]='0';
}
// REV(str);
int pos = LOGN + find(num.begin(),num.end(),str)-num.begin();
ans[i]=pos;
}
return ans;
}
컴파일 시 표준 에러 (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... |