Submission #164080

# Submission time Handle Problem Language Result Execution time Memory
164080 2019-11-17T10:55:37 Z dandrozavr "The Lyuboyn" code (IZhO19_lyuboyn) C++14
100 / 100
583 ms 37644 KB
/*
Uruchamiamy samolot zwiadowczy ( + 500% do wzlamaniej )

/▄/  /█/  /🔥/   /▐/   /▌/ /▀/ /░/ /◐ / choose  your  own style

***IT'S OUR LONG WAY TO THE OIILLLL***


░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░████████░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█████████░░░░░░░░░░░░░░░░░▌░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░◐◐◐█████████▀▀▀▀▀▀🔥░░░░░░░░███░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█████████░░░░░░░░░░░░░░░░░░░░▌░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█████████░░░░░░░░░░░░░░░░░░░░█▌░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▄▄▀██████████████████████████████████████████████████
░░░░░░░░░░░░░░░░░░░░░░░░░░▄▄▄████▄████████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ █████
░░░░░░░░░░░░░░░░░░░░░░░░░░░▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█████████▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█████████░░░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░◐◐◐█████████▀▀▀▀▀▀🔥░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█████████░░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█████████░░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░████████░░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░███████░░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██████░░░░░░░░░░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█████░░░░░░░░░░░░░░░
*/



//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")

#include <bits/stdc++.h>
//#include <grader.cpp>

using namespace std;
#include <ext/pb_ds/detail/standard_policies.hpp>'
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;template <typename T> using ordered_set = tree <T, null_type, less< T >, rb_tree_tag,tree_order_statistics_node_update>;

#define pb push_back
#define ll long long
#define ld long double
#define fi first
#define se second
#define pii pair < ll , int >
#define pipii pair< int, pair < int , int > >
#define siz(n) (int)(n.size())
#define TIME 1.0 * clock() / CLOCKS_PER_SEC
mt19937 gen(chrono::high_resolution_clock::now().time_since_epoch().count());

const int inf=1e9 + 7;
const ll inf18=1e18 + 7;
const int N=1e6 + 7;
const int MN = 2097152;
const int M = 1e9 + 7;


vector < vector < int > > all;

void rec(vector < int > a, int now, int n)
{
    if (!now)
    {
        all.pb(a);
        return;
    }
    int st = 0;
    if (a.size())
        st = a.back() + 1;
    for (int i = st; i < n; ++i)
        {
            a.pb(i);
            rec(a, now - 1, n);
            a.pop_back();
        }

}

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    srand(time(0));
    #ifdef Estb_probitie
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    int n, k, t;
    cin >> n >> k >> t;
    if (k % 2 == 0)
    {
        cout << -1;
        return 0;
    }
    unordered_set < string > s;
    vector < int > non;
    rec(non, k, n);
    string q, inp;
    cin >> inp;

//    for (int i = 0; i < n; ++i) q+= char('0');
    q = inp;
    s.insert(q);
    cout << (1 << n) << endl;
    while(s.size() <= (1 << n))
    {
        cout<<q<<'\n';
        if (s.size() == (1 << n)) return 0;
        bool byl = 0;
        vector < int > ch;
        for (int i = 0; i < q.size(); ++i)
            ch.pb(i);
        for (auto ch : all)
        {
            string z = q;
            for (int j = 0; j < k; ++j)
               z[ch[j]] = !(z[ch[j]] - 48) + '0';

            if (!s.count(z))
            {
                s.insert(z);
                q = z;
                byl =1;
                break;
            }
        }
        if (!byl) break;
    }
}

Compilation message

lyuboyn.cpp:36:50: warning: missing terminating ' character
 #include <ext/pb_ds/detail/standard_policies.hpp>'
                                                  ^
lyuboyn.cpp:36:50: warning: extra tokens at end of #include directive
lyuboyn.cpp: In function 'int main()':
lyuboyn.cpp:108:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while(s.size() <= (1 << n))
           ~~~~~~~~~^~~~~~~~~~~
lyuboyn.cpp:111:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (s.size() == (1 << n)) return 0;
             ~~~~~~~~~^~~~~~~~~~~
lyuboyn.cpp:114:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (int i = 0; i < q.size(); ++i)
                         ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Ok
2 Correct 2 ms 376 KB Ok
3 Correct 2 ms 376 KB Ok
4 Correct 2 ms 376 KB Ok
5 Correct 2 ms 376 KB Ok
6 Correct 2 ms 376 KB Ok
7 Correct 2 ms 376 KB Ok
8 Correct 2 ms 376 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 425 ms 33668 KB Ok
2 Correct 231 ms 16828 KB Ok
3 Correct 3 ms 376 KB Ok
4 Correct 2 ms 376 KB Ok
5 Correct 2 ms 376 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Ok
2 Correct 9 ms 1144 KB Ok
3 Correct 192 ms 16824 KB Ok
4 Correct 85 ms 8580 KB Ok
5 Correct 2 ms 376 KB Ok
6 Correct 4 ms 504 KB Ok
7 Correct 32 ms 3368 KB Ok
8 Correct 2 ms 376 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 518 ms 37308 KB Ok
2 Correct 450 ms 34116 KB Ok
3 Correct 427 ms 33548 KB Ok
4 Correct 234 ms 18908 KB Ok
5 Correct 195 ms 16824 KB Ok
6 Correct 86 ms 8712 KB Ok
7 Correct 83 ms 8444 KB Ok
8 Correct 34 ms 3368 KB Ok
9 Correct 40 ms 3880 KB Ok
10 Correct 23 ms 1912 KB Ok
11 Correct 3 ms 504 KB Ok
12 Correct 3 ms 376 KB Ok
13 Correct 3 ms 376 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 425 ms 33668 KB Ok
2 Correct 231 ms 16828 KB Ok
3 Correct 3 ms 376 KB Ok
4 Correct 2 ms 376 KB Ok
5 Correct 2 ms 376 KB Ok
6 Correct 2 ms 376 KB Ok
7 Correct 9 ms 1144 KB Ok
8 Correct 192 ms 16824 KB Ok
9 Correct 85 ms 8580 KB Ok
10 Correct 2 ms 376 KB Ok
11 Correct 4 ms 504 KB Ok
12 Correct 32 ms 3368 KB Ok
13 Correct 2 ms 376 KB Ok
14 Correct 518 ms 37308 KB Ok
15 Correct 450 ms 34116 KB Ok
16 Correct 427 ms 33548 KB Ok
17 Correct 234 ms 18908 KB Ok
18 Correct 195 ms 16824 KB Ok
19 Correct 86 ms 8712 KB Ok
20 Correct 83 ms 8444 KB Ok
21 Correct 34 ms 3368 KB Ok
22 Correct 40 ms 3880 KB Ok
23 Correct 23 ms 1912 KB Ok
24 Correct 3 ms 504 KB Ok
25 Correct 3 ms 376 KB Ok
26 Correct 3 ms 376 KB Ok
27 Correct 511 ms 34920 KB Ok
28 Correct 274 ms 17748 KB Ok
29 Correct 583 ms 37636 KB Ok
30 Correct 21 ms 2040 KB Ok
31 Correct 3 ms 504 KB Ok
32 Correct 11 ms 1016 KB Ok
33 Correct 40 ms 3372 KB Ok
34 Correct 2 ms 376 KB Ok
35 Correct 2 ms 376 KB Ok
36 Correct 3 ms 376 KB Ok
37 Correct 2 ms 376 KB Ok
38 Correct 244 ms 17580 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 248 ms 17444 KB Ok
2 Correct 506 ms 34820 KB Ok
3 Correct 577 ms 37644 KB Ok
4 Correct 21 ms 2040 KB Ok
5 Correct 3 ms 376 KB Ok
6 Correct 39 ms 3368 KB Ok
7 Correct 430 ms 33916 KB Ok
8 Correct 3 ms 504 KB Ok
9 Correct 2 ms 376 KB Ok
10 Correct 3 ms 376 KB Ok
11 Correct 96 ms 8452 KB Ok
12 Correct 280 ms 17720 KB Ok