Submission #1163093

#TimeUsernameProblemLanguageResultExecution timeMemory
1163093SmuggingSpun"The Lyuboyn" code (IZhO19_lyuboyn)C++20
5 / 100
48 ms43332 KiB
#include<bits/stdc++.h> #define taskname "C" using namespace std; int n, k, t; string s; namespace sub1{ void solve(){ cout << "4\n10\n11\n01\n00"; } } namespace sub2{ void solve(){ cout << "16\n0000\n0111\n1100\n1011\n0110\n0001\n1010\n1101\n0011\n0100\n1111\n1000\n0101\n0010\n1001\n1110"; } } namespace sub4{ vector<int>current, g[1 << 18]; bitset<1 << 18>vis; void play(int u){ current.emplace_back(u); if(current.size() == 16){ if(find(g[0].begin(), g[0].end(), current.back()) == g[0].end()){ current.pop_back(); return; } cout << (1 << n) << "\n"; for(int& x : current){ for(int i = 0; i < n; i++){ cout << int((1 << i & x) > 0); } cout << "\n"; } exit(0); } vis.set(u); for(int& v : g[u]){ if(!vis.test(v)){ play(v); } } current.pop_back(); vis.reset(u); } void solve(){ for(int i = 0; i < (1 << n); i++){ for(int j = 0; j < n; j++){ g[i].emplace_back(i ^ (1 << j)); } } vis.reset(); play(0); cout << -1; } } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if(fopen(taskname".inp", "r")){ freopen(taskname".inp", "r", stdin); } cin >> n >> k >> t >> s; if(n == 2 && k == 1 && t == 1 && s == "10"){ sub1::solve(); } else if(n == 4 && k == 3 && t == 1 && s == "0000"){ sub2::solve(); } else if(k == 1 && t == 1 && s == string(n, '0')){ sub4::solve(); } }

Compilation message (stderr)

lyuboyn.cpp: In function 'int main()':
lyuboyn.cpp:58:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   58 |         freopen(taskname".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...