Submission #403067

#TimeUsernameProblemLanguageResultExecution timeMemory
403067ly20"The Lyuboyn" code (IZhO19_lyuboyn)C++17
3 / 100
282 ms7484 KiB
#include<bits/stdc++.h> using namespace std; const int MAXN = 1 << 19; int n, k, t, s; int marc[MAXN]; vector<int> getK1(int n); int scanBit(int tam); void printBit(int tam, int val); int main(){ scanf("%d %d %d", &n, &k, &t); s = scanBit(n); if(k % 2 == 0){ printf("-1\n"); return 0; } vector<int> ord = getK1(n); vector<int> ans; for(int i = 0; i < ord.size(); i++){ ans.push_back(s^ord[i]); for(int j = 0; j < n; j++){ if((1 << j) & ord[i]){ for(int x = 0; x < k; x++){ int cur = (j + x) % n; ans[i] ^= (1 << cur); } } } } int cnt = 0; printf("%d\n", 1 << n); for(int i = 0; i < ans.size(); i++) printBit(n, ans[i]); } vector<int> getK1(int n){ vector<int> ret; if(n == 1){ ret.push_back(0); ret.push_back(1); return ret; } vector<int> aux = getK1(n - 1); for(int i = 0; i < aux.size(); i++) ret.push_back(aux[i]); for(int i = aux.size() - 1; i >= 0; i--){ ret.push_back(aux[i] | (1 << (n - 1))); } return ret; } int scanBit(int tam){ int ret = 0; for(int i = tam - 1; i >= 0; i--){ char aux; scanf(" %c", &aux); if(aux == '1') ret |= (1 << i); } return ret; } void printBit(int tam, int val){ for(int i = tam - 1; i >= 0; i--){ if((1 << i) & val) printf("1"); else printf("0"); } printf("\n"); }

Compilation message (stderr)

lyuboyn.cpp: In function 'int main()':
lyuboyn.cpp:24:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |  for(int i = 0; i < ord.size(); i++){
      |                 ~~^~~~~~~~~~~~
lyuboyn.cpp:37:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |  for(int i = 0; i < ans.size(); i++)
      |                 ~~^~~~~~~~~~~~
lyuboyn.cpp:35:6: warning: unused variable 'cnt' [-Wunused-variable]
   35 |  int cnt = 0;
      |      ^~~
lyuboyn.cpp: In function 'std::vector<int> getK1(int)':
lyuboyn.cpp:49:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |  for(int i = 0; i < aux.size(); i++)
      |                 ~~^~~~~~~~~~~~
lyuboyn.cpp: In function 'int main()':
lyuboyn.cpp:16:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |  scanf("%d %d %d", &n, &k, &t);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
lyuboyn.cpp: In function 'int scanBit(int)':
lyuboyn.cpp:61:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   61 |   scanf(" %c", &aux);
      |   ~~~~~^~~~~~~~~~~~~
#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...