# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
290958 | Plurm | "The Lyuboyn" code (IZhO19_lyuboyn) | C++11 | 312 ms | 35192 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int lsb[300005];
int rmp[300005];
int seq[300005];
set<string> s;
int main(){
int n,k,t;
scanf("%d%d%d",&n,&k,&t);
if(k % 2 == 0 || k >= n){
printf("-1\n");
return 0;
}
for(int i = 0; i <= 18; i++) rmp[1 << i] = i;
for(int i = 0; i < (1 << n); i += 2){
int lsb1 = rmp[i+1 & -(i+1)];
int lsb2 = rmp[i+2 & -(i+2)];
int c = 1;
for(int j = 0; j < n; j++){
if(j != lsb1 && j != lsb2 && c < k){
c++;
seq[i] |= 1 << j;
}
}
seq[i+1] = seq[i];
}
printf("%d\n", 1 << n);
char bs[32];
scanf("%s",bs);
if(strlen(bs) != n) while(true);
int parsed = 0;
for(int i = 0; i < n; i++){
parsed *= 2;
parsed += bs[i] == '1' ? 1 : 0;
}
printf("%s\n",bs);
s.insert(bs);
for(int i = 1; i < (1 << n); i++){
int bit = rmp[i & -i];
int toggidx = bit;
toggidx = n-toggidx-1;
bs[toggidx] = '0'+'1'-bs[toggidx];
for(int j = 0; j < n; j++){
if(seq[i-1] & (1 << j)) bs[n-j-1] = '0'+'1'-bs[n-j-1];
}
if(s.count(bs)) while(true);
s.insert(bs);
printf("%s\n",bs);
}
return 0;
}
Compilation message (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... |