제출 #471393

#제출 시각아이디문제언어결과실행 시간메모리
471393aZvezda"The Lyuboyn" code (IZhO19_lyuboyn)C++14
3 / 100
337 ms6440 KiB
#include <bits/stdc++.h> using namespace std; #define endl "\n" typedef long long ll; vector<int> build(int n, int k) { if(k == 1) { if(n == 1) { return {0, 1}; } auto ans = build(n - 1, k); auto cpy = ans; reverse(cpy.begin(), cpy.end()); vector<int> ret; for(auto it : ans) { ret.push_back(it * 2); } for(auto it : cpy) { ret.push_back(it * 2 + 1); } return ret; } auto ans = build(n - 2, k - 2); vector<int> ret; for(auto it : ans) { ret.push_back(it * 4 + 0); ret.push_back(it * 4 + 3); } for(auto it : ans) { ret.push_back((it ^ (1 << (k - 1))) * 4 + 1); ret.push_back((it ^ (1 << (k - 1))) * 4 + 2); } return ret; } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, k, t, s; cin >> n >> k >> t; string str; cin >> str; for(auto it : str) { s = (s * 2) + (it - '0'); } s = (1 << n) - 1 - s; if(k % 2 == 0) { cout << -1 << endl; return 0; } auto ans = build(n, k); cout << ans.size() << endl; for(auto it : ans) { int real = it ^ s; for(int i = 0; i < n; i ++) { cout << (bool)(real & (1 << i)); } cout << endl; } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

lyuboyn.cpp: In function 'int main()':
lyuboyn.cpp:47:4: warning: 's' may be used uninitialized in this function [-Wmaybe-uninitialized]
   47 |  s = (1 << n) - 1 - s;
      |  ~~^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...