# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
343821 | Tosic | "The Lyuboyn" code (IZhO19_lyuboyn) | C++14 | 1076 ms | 23648 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define maxn 400010
using namespace std;
int n, k, t, ans;
vector<int> curR,masks;
bool was[maxn];
int bD(int a, int b){
return __builtin_popcount(a^b)==k;
}
void printR(){
cout << (1<<n) << '\n';
for(auto i : curR){
bitset<32> tmp = i;
//cout << tmp;
for(int j = n-1; j >= 0; --j){
cout << tmp[j];
}
cout << '\n';
}
exit(0);
}
void getR(int x){
if(was[curR.back()]){
return;
}
if(x == (1<<n)){
if(t == 1 and bD(curR[0],curR.back())){
printR();
}
if(!t and !bD(curR[0],curR.back())){
printR();
}
return;
}
was[curR.back()] = 1;
for(auto i : masks){
curR.push_back(curR.back()^i);
getR(x+1);
curR.pop_back();
}
was[curR.back()] = 0;
}
int main(){
ios_base::sync_with_stdio(0);
cout.tie(0);
cin.tie(0);
string s;
cin >> n >> k >> t >> s;
int res = 0;
for(int i =0 ; i < s.length(); ++i){
res *= 2;
res += (s[i]-'0');
}
for(int i = 0; i < (1<<n); ++i){
if(bD(0, i)){
masks.push_back(i);
}
}
curR.push_back(res);
getR(1);
cout << -1;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |