# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
498610 | 2021-12-25T18:49:58 Z | nickmet2004 | "The Lyuboyn" code (IZhO19_lyuboyn) | C++11 | 3 ms | 812 KB |
#include<bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int n , k , T; string s; int p; main (){ ios_base::sync_with_stdio(0); cin.tie(0); cin >> n>>k>>T>>s; vector<int> v; for(int i= 0; i < (1<<n); ++i){ if(__builtin_popcount(i)==k){ v.emplace_back(i); } } int X= 0; for(int i = 0; i< s.size(); ++i){ if(s[i]=='1')X+=(1<<(s.size()-i-1)); } cout << X<<endl; // for(int x : v)cout <<x<<endl; int M = (1<<n)- 1; vector<int> ans; ans.emplace_back(X); int ok = 0; int y = X^v[0]; ans.emplace_back(y); ans.emplace_back(y^v[1]); int b = 2; M-=2; int ab; for(int i = 0; i< M; ++i){ if(p == v.size()){ ok=1;break; } if(i&1^1){ ab = ans.back()^v[p]; ans.emplace_back(ab); ++p; }else{ ab = ans.back()^v[b]; ans.emplace_back(ab); ++b; } } if(ok){ cout<<-1<<endl;return 0; } //for(int x : ans)cout <<x << " "; for(int i = 0; i < ans.size();++i){ string s=""; int x = ans[i]; while(x){ int y = x % 2; s += (char)(y+'0'); x/=2; } if(ans[i]==0){for(int k = 0; k < n; ++k)cout<<0;cout<<endl;} else{ for(int k =0; k < n-s.size(); ++k)s+='0'; reverse(s.begin(),s.end()); cout <<s<<endl; } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 312 KB | The output is neither -1 nor the length of the answer |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 308 KB | The output is neither -1 nor the length of the answer |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | The output is neither -1 nor the length of the answer |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | The output is neither -1 nor the length of the answer |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | The output is neither -1 nor the length of the answer |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 812 KB | The output is neither -1 nor the length of the answer |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | The output is neither -1 nor the length of the answer |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 292 KB | The output is neither -1 nor the length of the answer |
2 | Halted | 0 ms | 0 KB | - |