Submission #363230

# Submission time Handle Problem Language Result Execution time Memory
363230 2021-02-05T10:15:06 Z Tenis0206 Norela (info1cup18_norela) C++11
100 / 100
257 ms 492 KB
#include <bits/stdc++.h>

using namespace std;
int n,m;
int Min = 1e9;
long long v[10000005];
string s,rez;
void Back(int k, long long sum)
{
    if(sum==(1LL<<(n+1))-2)
    {
        if(k-1<Min || (k-1==Min && s<rez))
        {
            Min = k-1;
            rez = s;
        }
    }
    if(k>m)
    {
        return;
    }
    for(int i=s[k-1]+1; i<=m; i++)
    {
        s.push_back(i);
        Back(k+1,(sum^v[i]));
        s.pop_back();
    }
}
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>m;
    for(int i=1; i<=m; i++)
    {
        int q;
        cin>>q;
        for(int j=1; j<=q; j++)
        {
            int b;
            cin>>b;
            v[i]+=(1LL<<b);
        }
    }
    s.push_back(0);
    Back(1,0);
    cout<<Min<<'\n';
    for(int i=1;i<rez.size();i++)
    {
        cout<<(int)(rez[i])<<' ';
    }
    return 0;
}

Compilation message

norela.cpp: In function 'int main()':
norela.cpp:48:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |     for(int i=1;i<rez.size();i++)
      |                 ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 364 KB Output is correct
2 Correct 4 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 4 ms 364 KB Output is correct
5 Correct 5 ms 364 KB Output is correct
6 Correct 4 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 364 KB Output is correct
2 Correct 4 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 4 ms 364 KB Output is correct
5 Correct 5 ms 364 KB Output is correct
6 Correct 4 ms 364 KB Output is correct
7 Correct 15 ms 364 KB Output is correct
8 Correct 31 ms 492 KB Output is correct
9 Correct 33 ms 492 KB Output is correct
10 Correct 35 ms 492 KB Output is correct
11 Correct 34 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 364 KB Output is correct
2 Correct 4 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 4 ms 364 KB Output is correct
5 Correct 5 ms 364 KB Output is correct
6 Correct 4 ms 364 KB Output is correct
7 Correct 15 ms 364 KB Output is correct
8 Correct 31 ms 492 KB Output is correct
9 Correct 33 ms 492 KB Output is correct
10 Correct 35 ms 492 KB Output is correct
11 Correct 34 ms 364 KB Output is correct
12 Correct 30 ms 364 KB Output is correct
13 Correct 60 ms 492 KB Output is correct
14 Correct 58 ms 492 KB Output is correct
15 Correct 59 ms 492 KB Output is correct
16 Correct 58 ms 364 KB Output is correct
17 Correct 58 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 364 KB Output is correct
2 Correct 4 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 4 ms 364 KB Output is correct
5 Correct 5 ms 364 KB Output is correct
6 Correct 4 ms 364 KB Output is correct
7 Correct 15 ms 364 KB Output is correct
8 Correct 31 ms 492 KB Output is correct
9 Correct 33 ms 492 KB Output is correct
10 Correct 35 ms 492 KB Output is correct
11 Correct 34 ms 364 KB Output is correct
12 Correct 30 ms 364 KB Output is correct
13 Correct 60 ms 492 KB Output is correct
14 Correct 58 ms 492 KB Output is correct
15 Correct 59 ms 492 KB Output is correct
16 Correct 58 ms 364 KB Output is correct
17 Correct 58 ms 384 KB Output is correct
18 Correct 119 ms 492 KB Output is correct
19 Correct 118 ms 364 KB Output is correct
20 Correct 237 ms 404 KB Output is correct
21 Correct 257 ms 364 KB Output is correct
22 Correct 234 ms 364 KB Output is correct
23 Correct 236 ms 492 KB Output is correct