Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #include <iomanip>
- #include<ext/pb_ds/assoc_container.hpp>
- #include<ext/pb_ds/tree_policy.hpp>
- using namespace std;
- using namespace __gnu_pbds;
- template<class T> using ordered_set =tree<T, null_type, less_equal<T>, rb_tree_tag,tree_order_statistics_node_update> ;
- template <typename T = int>ostream &operator<<(ostream &out, const vector<T> &v){for (const T &x : v) out << x << ' ';return out;}
- template <typename T = int>istream &operator>>(istream &in, vector<T> &v){for (auto &x : v) in >> x;return in;}
- using namespace __gnu_pbds;
- #define getline(s) getline(cin >> ws ,s)
- #define ll long long
- #define sz(s) (int)(s.size())
- #define cin(vec, n); for (int i = 0; i < n and cin >> vec[i]; i++);
- const int M = 2 * 1e5 + 5;
- #define HABIBA ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
- #define PI 3.14159
- #define ull unsigned long long
- #define all(s) s.begin(), s.end()
- #define Mod 1'000'000'007
- #define to_binary(bin) stoll(bin, nullptr, 10)
- #define ceill(n, m) (((n) / (m)) + ((n) % (m) ? 1 : 0))
- #define cin(v) for(auto &i: v) cin>>i
- #define cout(v) for(auto &i: v) cout<<i<<" ";
- using namespace std;
- #define Num_of_Digits(n) ((int)log10(n) + 1)
- // freopen("equal.in", "r", stdin);
- /* #ifndef ONLINE_JUDGE
- freopen("machines.in", "r", stdin), freopen("standard output", "w", stdout);
- #endif*/
- /*void set_file(string& file_name){
- freopen((file_name + ".in").c_str(), "r", stdin);
- freopen((file_name + ".out").c_str(), "w", stdout);
- }*/
- vector < ll > ans;
- vector < vector < ll > > test;
- void solve(ll index , ll n){
- if(index == n){
- test.push_back(ans);
- // cout << ans << "\n";
- return;
- }
- ans.push_back(0);
- solve(index + 1 , n);
- ans.pop_back();
- ans.push_back(1);
- solve(index + 1 , n);
- ans.pop_back();
- return;
- }
- int main() {
- #ifndef ONLINE_JUDGE
- freopen("input.txt", "r", stdin),
- freopen("output.txt", "w", stdout);
- #endif
- HABIBA
- ll t; cin >> t;
- while(t--){
- ll n; cin >> n;
- solve(0 , n);
- sort(all(test));
- for(auto & i : test){
- // for(auto j : i) cout << j << "\n";
- cout << i << "\n";
- }
- ans.clear() , test.clear();
- }
- return 0;
- }
- //vector < vector < int > > v(n , vector < int > (m));
- //for(auto & I : v){
- //for(auto & x : I){
- //cin >> x ;
- // 2d vector and cin
- //}
- //}
- // mst2.erase(prev(mst2.end()));
- //bool operator < (const Indx &other) const{
- //
- //}
- // find by order --> iterator // *find by order --> value
- // order of key --> index + 1
- //cout << __builtin_popcount(n);
- //auto pr = std::max_element(map.begin(), map.end(), [](const auto &x, const auto &y) {
- // return x.second < y.second;
- //std::cout << std::fixed << std::setprecision(2) << d;
Advertisement
Add Comment
Please, Sign In to add comment