Submission #681622

# Submission time Handle Problem Language Result Execution time Memory
681622 2023-01-13T13:15:41 Z Karuk "The Lyuboyn" code (IZhO19_lyuboyn) C++14
19 / 100
53 ms 22772 KB
#include<bits/stdc++.h>
using namespace std;
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n,k,t;cin>>n>>k>>t;
    string s;cin>>s;
    if(k%2==0){cout<<-1;return 0;}
    if(t==1) {
        vector<string>v;
        vector<int>st;
        st.push_back(0);
        for(int i=1;i<n;i++) {
            vector<int>t=st;
            reverse(t.begin(),t.end());
            st.push_back(i);
            for(int j:t)st.push_back(j);
        }
        string cur="";
        for(int i=0;i<n;i++)cur+='0';
        v.push_back(cur);
        for(int i=0;i<st.size();i++) {
            int ind=st[i];
            for(int q=0;q<k;q++) {
                if(cur[ind]=='0')cur[ind]='1';
                else cur[ind]='0';
                ind++;
                if(ind==n)ind=0;
            }
            v.push_back(cur);
        }
        cout<<(1<<n)<<'\n';
        int ind=0;
        for(int i=0;i<v.size();i++){if(v[i]==s){ind=i;break;}}
        if(ind==0) {
            for(string &ss:v)cout<<ss<<'\n';
        }
        else {
            for(int i=ind;i<v.size();i++)cout<<v[i]<<'\n';
            for(int i=0;i<ind;i++)cout<<v[i]<<'\n';
        }

    } else {
        cout<<-1;return 0;
    }
    return 0;
}

Compilation message

lyuboyn.cpp: In function 'int main()':
lyuboyn.cpp:21:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |         for(int i=0;i<st.size();i++) {
      |                     ~^~~~~~~~~~
lyuboyn.cpp:33:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |         for(int i=0;i<v.size();i++){if(v[i]==s){ind=i;break;}}
      |                     ~^~~~~~~~~
lyuboyn.cpp:38:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |             for(int i=ind;i<v.size();i++)cout<<v[i]<<'\n';
      |                           ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Ok
2 Correct 0 ms 212 KB Ok
3 Correct 0 ms 212 KB Ok
4 Correct 0 ms 212 KB Ok
5 Correct 0 ms 212 KB Ok
6 Correct 0 ms 212 KB Ok
7 Correct 0 ms 212 KB Ok
8 Correct 0 ms 212 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 37 ms 22772 KB Ok
2 Correct 18 ms 11328 KB Ok
3 Correct 0 ms 340 KB Ok
4 Correct 0 ms 212 KB Ok
5 Correct 0 ms 212 KB Ok
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output -1 while solution exists
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output -1 while solution exists
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 37 ms 22772 KB Ok
2 Correct 18 ms 11328 KB Ok
3 Correct 0 ms 340 KB Ok
4 Correct 0 ms 212 KB Ok
5 Correct 0 ms 212 KB Ok
6 Incorrect 0 ms 212 KB Output -1 while solution exists
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 28 ms 11392 KB Ok
2 Correct 53 ms 22664 KB Ok
3 Correct 45 ms 22704 KB Ok
4 Correct 3 ms 1228 KB Ok
5 Correct 0 ms 340 KB Ok
6 Correct 5 ms 2120 KB Ok
7 Correct 41 ms 22696 KB Ok
8 Incorrect 0 ms 340 KB The values in the output sequence are not pairwise distinct!
9 Halted 0 ms 0 KB -