Submission #344902

#TimeUsernameProblemLanguageResultExecution timeMemory
344902bash"The Lyuboyn" code (IZhO19_lyuboyn)C++17
31 / 100
303 ms23264 KiB
// // A.cpp // torelax // // Created by Rakhman on 1/5/21. // #include <cstring> #include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <iostream> #include <iomanip> #include <cstdio> #include <queue> #include <cmath> #include <cstdlib> #include <ctime> #include <cassert> #include <iterator> #define ios ios_base::sync_with_stdio(0), cout.tie(0), cin.tie(0); #define S second #define F first #define pb push_back #define nl '\n' #define NL cout << '\n'; #define EX exit(0) #define all(s) s.begin(), s.end() #define no_answer {cout << "NO"; exit(0);} #define FOR(i, start, finish, k) for(llong i = start; i <= finish; i += k) const long long mxn = 1e6 + 110; const long long mnn = 3e3 + 2; const long long mod = 1e9 + 7; const long long inf = 1e18; const long long OO = 1e9 + 100; typedef long long llong; typedef unsigned long long ullong; using namespace std; int n, k, t, cnt = 0; bool used[(1 << 18) + 100]; vector<int> trap; vector<int> ans; int to_dec(string s){ int ans = 0; while(s.size()) { ans = ans * 2 + s.back()-'0'; s.pop_back(); } return ans; } void outt(int x){ for(int j = n- 1; j >= 0; j--){ if(((1 << j) & x)){ cout << 1; }else{ cout << 0; } } cout << nl; } void rec(int cur){ used[cur] = 1; cnt++; ans.push_back(cur); if(cnt == (1 << n)){ cout << ans.size() << nl; for(int i = 0; i < ans.size(); i++){ outt(ans[i]); } exit(0); } for(int i = 0; i < trap.size(); i++){ int lol = trap[i]; if(!used[lol ^ cur]) { rec(lol ^ cur); } } } int main() { cin >> n >> k >> t; string s; cin >> s; int x = to_dec(s); for(int i = 1; i < (1 << n); i++){ if(__builtin_popcount(i) == k){ trap.push_back(i); } } rec(x); }

Compilation message (stderr)

lyuboyn.cpp: In function 'void rec(int)':
lyuboyn.cpp:84:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   84 |         for(int i = 0; i < ans.size(); i++){
      |                        ~~^~~~~~~~~~~~
lyuboyn.cpp:89:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   89 |     for(int i = 0; i < trap.size(); i++){
      |                    ~~^~~~~~~~~~~~~
#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...