Submission #636805

#TimeUsernameProblemLanguageResultExecution timeMemory
636805valerikk"The Lyuboyn" code (IZhO19_lyuboyn)C++17
3 / 100
36 ms6288 KiB
#include <cstdio> #include <vector> #include <algorithm> using namespace std; int N, K, T; int f[1 << 19]; int read() { static char buf[19]; scanf("%s", buf); int res = 0; for(int i = 0; i < N; ++i) { res |= (buf[i] - '0') << i; } return res; } void write(int x) { static char buf[19]; for(int i = 0; i < N; ++i) { buf[i] = '0' + ((x >> i) & 1); } buf[N] = '\0'; printf("%s\n", buf); } int main() { scanf("%d%d%d", &N, &K, &T); int S = read(); if(!(K & 1)) { printf("-1\n"); return 0; } f[0] = 0; f[1] = 1; for(int p = 1; p <= K; ++p) { for(int i = 0; i < (1 << p); ++i) { f[(1 << p) + i] = f[(1 << p) - i - 1] ^ (1 << p); } } for(int i = 0; i < (1 << (K + 1)); i += 2) { f[i] ^= (1 << (K + 1)) - 1; } for(int p = K + 1; p < N; ++p) { for(int i = 0; i < (1 << p); ++i) { f[(1 << p) + i] = f[(1 << p) - i - 1] ^ (1 << p) ^ ((1 << (K - 1)) - 1); } } int start = 0; while(f[start] != S) { ++start; } rotate(f, f + start, f + (1 << N)); for(int i = 0; i < (1 << N); ++i) { write(f[i]); } }

Compilation message (stderr)

lyuboyn.cpp: In function 'int read()':
lyuboyn.cpp:13:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |  scanf("%s", buf);
      |  ~~~~~^~~~~~~~~~~
lyuboyn.cpp: In function 'int main()':
lyuboyn.cpp:32:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |  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...