#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#include "messy.h"
set<int>st[128];
vector<int> restore_permutation(int n, int w, int r)
{
vector<int> res(n), rev(n),pl(3);
//일단 0,1,2는 알아야 함
for(int i=1;i<8;i++){
string S(n, '0'), temp(n, '0');
if(i&1)S[0]='1';
if(i&2)S[1]='1';
if(i&4)S[2]='1';
for(int j=3;j<n;j++){
if(j&(1<<(i-1)))S[j]='1';
}
add_element(S);
}
string S(n, '1');
for (int i = 0; i < 3; i++)
{
S[i] = '0';
add_element(S);
}
compile_set();
string temp(n,'0');
for (int ii = 0; ii < 3; ii++)
{
for (int i = 0; i < n; i++)
{
if (temp[i] == '1')
continue;
temp[i] = '1';
if (check_element(temp))
{
res[i] = ii;
pl[ii]=i;
break;
}
temp[i] = '0';
}
}
for(int i=3;i<n;i++){
for(int j=0;j<n;j++){
if(pl[0]==j || pl[1]==j || pl[2]==j)continue;
st[i].insert(j);
//i->j였음.
}
}
for(int i=1;i<8;i++){
string S(n, '0'), temp;
if(i&1)S[0]='1';
if(i&2)S[1]='1';
if(i&4)S[2]='1';
vector<int>checked(n);
for(int j=0;j<n;j++){
if(pl[0]==j || pl[1]==j || pl[2]==j)continue;
temp=S;
temp[j]='1';
if(check_element(temp))checked[j]=1;
}
for(int j=3;j<n;j++){
if(j&(1<<(i-1))){
for (auto it = st[j].begin(); it != st[j].end(); ) {
if (!checked[*it]) {
it = st[j].erase(it); // erase는 삭제 후 다음 iterator 반환
} else {
++it;
}
}
}
}
}
for(int i=3;i<n;i++){
int x=*st[i].begin();
res[x]=i;
}
return res;
}
컴파일 시 표준 에러 (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... |