Submission #257704

#TimeUsernameProblemLanguageResultExecution timeMemory
257704BThero"The Lyuboyn" code (IZhO19_lyuboyn)C++17
19 / 100
448 ms6740 KiB
// chrono::system_clock::now().time_since_epoch().count() #include<bits/stdc++.h> #define pb push_back #define eb emplace_back #define mp make_pair #define fi first #define se second #define all(x) (x).begin(), (x).end() #define debug(x) cerr << #x << " = " << x << endl; using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; vi gen(int n, int k) { if (k % 2 == 0) { return {}; } vi ret; if (k == 1) { if (n == 1) { return vi({0, 1}); } vi A = gen(n - 1, k); vi B = A; reverse(all(B)); for (int &x : B) { x += (1 << (n - 1)); } for (int x : A) { ret.pb(x); } for (int x : B) { ret.pb(x); } return ret; } if (n % 2 == k % 2) { return {}; } vi A = gen(n - 2, k - 2); int rot = (1 << (n - 1)) + (1 << (n - 2)); int cur = 0; for (int i : {n - 2, n - 1, n - 2, n - 1}) { for (int x : A) { ret.pb(cur + x); cur ^= rot; } cur ^= (1 << i); rotate(A.begin(), A.begin() + 1, A.end()); } return ret; } void solve() { int n, k, T; string S; scanf("%d %d %d", &n, &k, &T); cin >> S; int st = 0; for (int i = 0; i < n; ++i) { if (S[i] == '1') { st += (1 << i); } } vi vec = gen(n, k); if (vec.empty()) { printf("-1\n"); return; } rotate(vec.begin(), find(all(vec), st), vec.end()); printf("%d\n", (1 << n)); for (int x : vec) { for (int i = 0; i < n; ++i) { printf("%d", (x >> i) & 1); } printf("\n"); } } int main() { int tt = 1; while (tt--) { solve(); } return 0; }

Compilation message (stderr)

lyuboyn.cpp: In function 'void solve()':
lyuboyn.cpp:73:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d %d", &n, &k, &T);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#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...