Submission #288098

#TimeUsernameProblemLanguageResultExecution timeMemory
288098tqbfjotld"The Lyuboyn" code (IZhO19_lyuboyn)C++14
34 / 100
273 ms14500 KiB
#include <bits/stdc++.h> using namespace std; vector<int> seq; vector<vector<int> > fl; int main(){ int n,k,t; scanf("%d%d%d",&n,&k,&t); if (k%2==0){ printf("-1"); return 0; } for (int x = 1; x<=(1<<n)/2; x++){ vector<int> to; if (k==1) to.push_back(x&-x); else if (k==3){ if ((x&-x)>=16){ to.push_back(x&-x); to.push_back(1); to.push_back(2); } else{ for (int X = 1; X<=8; X<<=1){ if (X!=(x&-x)){ to.push_back(X); } } } } fl.push_back(to); } int cur = 0; for (int x = 0; x<(1<<n); x++){ seq.push_back(cur); //printf("pushed %d\n",cur); if (x>=fl.size()){ for (auto y : fl[x-fl.size()]){ cur^=y; } } else { for (auto y : fl[x]){ cur ^= y; } } } if (n==4 && k==3 && t==1){ seq.clear(); seq = {0,14,3,13,6,8,5,11,12,2,15,1,10,4,9,7}; } int num = 0; for (int x = 0; x<n; x++){ char c; num<<=1; scanf(" %c",&c); num += c-'0'; } int stpos = -1; for (int x = 0; x<seq.size(); x++){ if (seq[x]==num){ stpos = x; } } assert(stpos!=-1); printf("%d\n",1<<n); for (int x = 0; x<(1<<n); x++){ for (int y = n-1; y>=0; y--){ if (seq[(x+stpos)%seq.size()]&(1<<y)){ printf("1"); } else printf("0"); } printf("\n"); } }

Compilation message (stderr)

lyuboyn.cpp: In function 'int main()':
lyuboyn.cpp:38:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |         if (x>=fl.size()){
      |             ~^~~~~~~~~~~
lyuboyn.cpp:61:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   61 |     for (int x = 0; x<seq.size(); x++){
      |                     ~^~~~~~~~~~~
lyuboyn.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    9 |     scanf("%d%d%d",&n,&k,&t);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~
lyuboyn.cpp:57:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   57 |         scanf(" %c",&c);
      |         ~~~~~^~~~~~~~~~
#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...