QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#437303#4825. Even and Odd Combinationsbiank230 2ms3836kbC++141.4kb2024-06-09 07:20:042024-06-09 07:20:04

Judging History

你现在查看的是最新测评结果

  • [2024-06-09 07:20:04]
  • 评测
  • 测评结果:0
  • 用时:2ms
  • 内存:3836kb
  • [2024-06-09 07:20:04]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define sz(x) int(x.size())
#define all(x) begin(x),end(x)
#define forsn(i,s,n) for(int i=int(s);i<int(n);i++)
#define forn(i,n) for(int i=0;i<int(n);i++)
#define dforsn(i,s,n) for(int i=int(n)-1;i>=int(s);i--)
#define dforn(i,n) for(int i=int(n)-1;i>=0;i--)
#define dbg(x) cerr<<#x<<": "<<x<<endl

#define fst first
#define snd second
#define pb push_back
#define eb emplace_back

typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;

//const int MAXN = 2e5+5;
//const ll INF = 1e18;
const int MOD = 1e9+7;

template<class x> ostream & operator<<(ostream & out, vector<x> v){
    out<<"[ ";
    for(auto y : v) out<<y<<" ";
    out<<"]";
    return out;
}

template<class a, class b> ostream & operator<<(ostream & out, pair<a, b> p){
    return out<<"("<<p.fst<<", "<<p.snd<<")";
}

int main(){
    //freopen(".in", "r", stdin);
//freopen(".out", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    
    int t;
    cin>>t;
    while(t--){
        int n,k;
        cin>>n>>k;
        ll mask=0;
        forn(i,k){
            int a;
            cin>>a; --a;
            mask+=1<<a;
        }
        mask^=(1<<(n-1));
        cout<<n<<' '<<__builtin_popcountll(mask)<<'\n';
        forn(i,n) if(mask>>i&1) cout<<i+1<<' ';
        cout<<'\n';
    }
    
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3812kb

input:

6
3 0
2 1
1
3 3
1 2 3
3 1
1
3 1
2
3 1
3

output:

3 1
3 
2 2
1 2 
3 2
1 2 
3 2
1 3 
3 2
2 3 
3 0


input:

6
3 1
3
2 2
1 2
3 2
1 2
3 2
1 3
3 2
2 3
3 0

output:

3 0

2 1
1 
3 3
1 2 3 
3 1
1 
3 1
2 
3 1
3 

result:

ok 12 lines

Test #2:

score: 100
Accepted
time: 0ms
memory: 3784kb

input:

1
1 0

output:

1 1
1 

input:

1
1 1
1

output:

1 0


result:

ok single line: '1 0'

Test #3:

score: 100
Accepted
time: 0ms
memory: 3792kb

input:

3
1 1
1
1 0
1 1
1

output:

1 0

1 1
1 
1 0


input:

3
1 0
1 1
1
1 0

output:

1 1
1 
1 0

1 1
1 

result:

ok 6 lines

Test #4:

score: 100
Accepted
time: 1ms
memory: 3604kb

input:

1000
12 7
1 2 3 5 6 7 9
11 6
3 5 6 7 8 11
12 7
1 6 7 9 10 11 12
11 6
1 2 3 9 10 11
12 7
2 3 4 6 7 9 10
9 3
3 7 8
12 10
1 2 3 5 7 8 9 10 11 12
12 5
2 6 10 11 12
10 4
2 4 8 10
12 7
1 3 4 7 10 11 12
11 3
3 6 7
11 6
3 5 7 8 9 10
12 5
1 4 8 11 12
11 6
2 3 5 6 9 10
12 5
2 4 7 11 12
12 6
3 4 5 6 10 12
10 6...

output:

12 8
1 2 3 5 6 7 9 12 
11 5
3 5 6 7 8 
12 6
1 6 7 9 10 11 
11 5
1 2 3 9 10 
12 8
2 3 4 6 7 9 10 12 
9 4
3 7 8 9 
12 9
1 2 3 5 7 8 9 10 11 
12 4
2 6 10 11 
10 3
2 4 8 
12 6
1 3 4 7 10 11 
11 4
3 6 7 11 
11 7
3 5 7 8 9 10 11 
12 4
1 4 8 11 
11 7
2 3 5 6 9 10 11 
12 4
2 4 7 11 
12 5
3 4 5 6 10 
10 5
2 ...

input:

1000
12 8
1 2 3 5 6 7 9 12
11 5
3 5 6 7 8
12 6
1 6 7 9 10 11
11 5
1 2 3 9 10
12 8
2 3 4 6 7 9 10 12
9 4
3 7 8 9
12 9
1 2 3 5 7 8 9 10 11
12 4
2 6 10 11
10 3
2 4 8
12 6
1 3 4 7 10 11
11 4
3 6 7 11
11 7
3 5 7 8 9 10 11
12 4
1 4 8 11
11 7
2 3 5 6 9 10 11
12 4
2 4 7 11
12 5
3 4 5 6 10
10 5
2 3 5 8 9
10 ...

output:

12 7
1 2 3 5 6 7 9 
11 6
3 5 6 7 8 11 
12 7
1 6 7 9 10 11 12 
11 6
1 2 3 9 10 11 
12 7
2 3 4 6 7 9 10 
9 3
3 7 8 
12 10
1 2 3 5 7 8 9 10 11 12 
12 5
2 6 10 11 12 
10 4
2 4 8 10 
12 7
1 3 4 7 10 11 12 
11 3
3 6 7 
11 6
3 5 7 8 9 10 
12 5
1 4 8 11 12 
11 6
2 3 5 6 9 10 
12 5
2 4 7 11 12 
12 6
3 4 5 6 ...

result:

ok 2000 lines

Test #5:

score: 100
Accepted
time: 1ms
memory: 3652kb

input:

1000
12 7
1 3 7 8 9 10 12
12 8
1 4 5 6 8 10 11 12
11 2
7 10
11 7
2 3 4 6 7 8 9
12 7
1 4 5 6 7 8 12
12 5
1 5 6 7 12
9 5
2 4 5 7 9
12 10
1 2 3 5 6 7 8 9 10 11
9 6
3 4 5 6 8 9
11 5
1 2 3 7 9
10 4
1 3 4 5
12 4
2 5 6 8
9 4
2 3 4 9
10 6
1 2 3 4 5 6
12 7
2 5 6 7 8 10 12
8 4
1 3 7 8
12 8
2 3 4 6 7 9 10 12
1...

output:

12 6
1 3 7 8 9 10 
12 7
1 4 5 6 8 10 11 
11 3
7 10 11 
11 8
2 3 4 6 7 8 9 11 
12 6
1 4 5 6 7 8 
12 4
1 5 6 7 
9 4
2 4 5 7 
12 11
1 2 3 5 6 7 8 9 10 11 12 
9 5
3 4 5 6 8 
11 6
1 2 3 7 9 11 
10 5
1 3 4 5 10 
12 5
2 5 6 8 12 
9 3
2 3 4 
10 7
1 2 3 4 5 6 10 
12 6
2 5 6 7 8 10 
8 3
1 3 7 
12 7
2 3 4 6 7 ...

input:

1000
12 6
1 3 7 8 9 10
12 7
1 4 5 6 8 10 11
11 3
7 10 11
11 8
2 3 4 6 7 8 9 11
12 6
1 4 5 6 7 8
12 4
1 5 6 7
9 4
2 4 5 7
12 11
1 2 3 5 6 7 8 9 10 11 12
9 5
3 4 5 6 8
11 6
1 2 3 7 9 11
10 5
1 3 4 5 10
12 5
2 5 6 8 12
9 3
2 3 4
10 7
1 2 3 4 5 6 10
12 6
2 5 6 7 8 10
8 3
1 3 7
12 7
2 3 4 6 7 9 10
12 6
2...

output:

12 7
1 3 7 8 9 10 12 
12 8
1 4 5 6 8 10 11 12 
11 2
7 10 
11 7
2 3 4 6 7 8 9 
12 7
1 4 5 6 7 8 12 
12 5
1 5 6 7 12 
9 5
2 4 5 7 9 
12 10
1 2 3 5 6 7 8 9 10 11 
9 6
3 4 5 6 8 9 
11 5
1 2 3 7 9 
10 4
1 3 4 5 
12 4
2 5 6 8 
9 4
2 3 4 9 
10 6
1 2 3 4 5 6 
12 7
2 5 6 7 8 10 12 
8 4
1 3 7 8 
12 8
2 3 4 6 ...

result:

ok 2000 lines

Test #6:

score: 100
Accepted
time: 1ms
memory: 3792kb

input:

1000
12 7
1 2 3 5 6 7 9
11 6
3 5 6 7 8 11
12 7
1 6 7 9 10 11 12
11 6
1 2 3 9 10 11
12 7
2 3 4 6 7 9 10
9 3
3 7 8
12 10
1 2 3 5 7 8 9 10 11 12
12 5
2 6 10 11 12
10 4
2 4 8 10
12 7
1 3 4 7 10 11 12
11 3
3 6 7
11 6
3 5 7 8 9 10
12 5
1 4 8 11 12
11 6
2 3 5 6 9 10
12 5
2 4 7 11 12
12 6
3 4 5 6 10 12
10 6...

output:

12 8
1 2 3 5 6 7 9 12 
11 5
3 5 6 7 8 
12 6
1 6 7 9 10 11 
11 5
1 2 3 9 10 
12 8
2 3 4 6 7 9 10 12 
9 4
3 7 8 9 
12 9
1 2 3 5 7 8 9 10 11 
12 4
2 6 10 11 
10 3
2 4 8 
12 6
1 3 4 7 10 11 
11 4
3 6 7 11 
11 7
3 5 7 8 9 10 11 
12 4
1 4 8 11 
11 7
2 3 5 6 9 10 11 
12 4
2 4 7 11 
12 5
3 4 5 6 10 
10 5
2 ...

input:

1000
12 8
1 2 3 5 6 7 9 12
11 5
3 5 6 7 8
12 6
1 6 7 9 10 11
11 5
1 2 3 9 10
12 8
2 3 4 6 7 9 10 12
9 4
3 7 8 9
12 9
1 2 3 5 7 8 9 10 11
12 4
2 6 10 11
10 3
2 4 8
12 6
1 3 4 7 10 11
11 4
3 6 7 11
11 7
3 5 7 8 9 10 11
12 4
1 4 8 11
11 7
2 3 5 6 9 10 11
12 4
2 4 7 11
12 5
3 4 5 6 10
10 5
2 3 5 8 9
10 ...

output:

12 7
1 2 3 5 6 7 9 
11 6
3 5 6 7 8 11 
12 7
1 6 7 9 10 11 12 
11 6
1 2 3 9 10 11 
12 7
2 3 4 6 7 9 10 
9 3
3 7 8 
12 10
1 2 3 5 7 8 9 10 11 12 
12 5
2 6 10 11 12 
10 4
2 4 8 10 
12 7
1 3 4 7 10 11 12 
11 3
3 6 7 
11 6
3 5 7 8 9 10 
12 5
1 4 8 11 12 
11 6
2 3 5 6 9 10 
12 5
2 4 7 11 12 
12 6
3 4 5 6 ...

result:

ok 2000 lines

Test #7:

score: 100
Accepted
time: 1ms
memory: 3824kb

input:

1000
12 6
4 6 7 8 9 11
11 3
5 8 9
12 4
2 3 6 7
11 4
4 7 10 11
12 6
2 3 6 7 9 12
11 5
2 5 6 9 11
10 2
3 9
12 5
3 5 6 10 12
12 9
1 2 4 6 7 8 9 11 12
8 3
2 4 8
8 5
2 3 4 5 8
10 8
1 2 4 5 6 7 8 10
12 7
1 2 3 4 6 7 11
11 7
1 4 5 6 7 9 10
12 8
1 2 3 4 8 9 10 12
12 8
1 2 5 6 7 8 9 12
11 6
1 2 4 7 9 11
12 7...

output:

12 7
4 6 7 8 9 11 12 
11 4
5 8 9 11 
12 5
2 3 6 7 12 
11 3
4 7 10 
12 5
2 3 6 7 9 
11 4
2 5 6 9 
10 3
3 9 10 
12 4
3 5 6 10 
12 8
1 2 4 6 7 8 9 11 
8 2
2 4 
8 4
2 3 4 5 
10 7
1 2 4 5 6 7 8 
12 8
1 2 3 4 6 7 11 12 
11 8
1 4 5 6 7 9 10 11 
12 7
1 2 3 4 8 9 10 
12 7
1 2 5 6 7 8 9 
11 5
1 2 4 7 9 
12 6
...

input:

1000
12 7
4 6 7 8 9 11 12
11 4
5 8 9 11
12 5
2 3 6 7 12
11 3
4 7 10
12 5
2 3 6 7 9
11 4
2 5 6 9
10 3
3 9 10
12 4
3 5 6 10
12 8
1 2 4 6 7 8 9 11
8 2
2 4
8 4
2 3 4 5
10 7
1 2 4 5 6 7 8
12 8
1 2 3 4 6 7 11 12
11 8
1 4 5 6 7 9 10 11
12 7
1 2 3 4 8 9 10
12 7
1 2 5 6 7 8 9
11 5
1 2 4 7 9
12 6
2 3 4 7 8 11...

output:

12 6
4 6 7 8 9 11 
11 3
5 8 9 
12 4
2 3 6 7 
11 4
4 7 10 11 
12 6
2 3 6 7 9 12 
11 5
2 5 6 9 11 
10 2
3 9 
12 5
3 5 6 10 12 
12 9
1 2 4 6 7 8 9 11 12 
8 3
2 4 8 
8 5
2 3 4 5 8 
10 8
1 2 4 5 6 7 8 10 
12 7
1 2 3 4 6 7 11 
11 7
1 4 5 6 7 9 10 
12 8
1 2 3 4 8 9 10 12 
12 8
1 2 5 6 7 8 9 12 
11 6
1 2 4 ...

result:

ok 2000 lines

Test #8:

score: 100
Accepted
time: 2ms
memory: 3764kb

input:

1000
11 6
1 4 7 8 9 11
12 7
1 2 4 8 9 11 12
10 4
2 4 8 9
12 6
1 2 3 6 7 11
8 3
4 5 8
11 5
1 2 5 7 11
12 7
2 3 4 6 10 11 12
10 5
1 4 5 6 10
12 3
7 8 9
12 4
5 9 10 11
12 7
4 5 6 7 8 10 12
12 6
3 5 7 8 9 12
12 6
1 3 4 7 8 11
12 7
1 2 3 7 8 10 12
12 7
2 4 5 6 7 9 10
10 6
1 3 4 5 6 9
11 6
3 5 6 7 9 11
12...

output:

11 5
1 4 7 8 9 
12 6
1 2 4 8 9 11 
10 5
2 4 8 9 10 
12 7
1 2 3 6 7 11 12 
8 2
4 5 
11 4
1 2 5 7 
12 6
2 3 4 6 10 11 
10 4
1 4 5 6 
12 4
7 8 9 12 
12 5
5 9 10 11 12 
12 6
4 5 6 7 8 10 
12 5
3 5 7 8 9 
12 7
1 3 4 7 8 11 12 
12 6
1 2 3 7 8 10 
12 8
2 4 5 6 7 9 10 12 
10 7
1 3 4 5 6 9 10 
11 5
3 5 6 7 9...

input:

1000
11 5
1 4 7 8 9
12 6
1 2 4 8 9 11
10 5
2 4 8 9 10
12 7
1 2 3 6 7 11 12
8 2
4 5
11 4
1 2 5 7
12 6
2 3 4 6 10 11
10 4
1 4 5 6
12 4
7 8 9 12
12 5
5 9 10 11 12
12 6
4 5 6 7 8 10
12 5
3 5 7 8 9
12 7
1 3 4 7 8 11 12
12 6
1 2 3 7 8 10
12 8
2 4 5 6 7 9 10 12
10 7
1 3 4 5 6 9 10
11 5
3 5 6 7 9
12 8
1 3 5...

output:

11 6
1 4 7 8 9 11 
12 7
1 2 4 8 9 11 12 
10 4
2 4 8 9 
12 6
1 2 3 6 7 11 
8 3
4 5 8 
11 5
1 2 5 7 11 
12 7
2 3 4 6 10 11 12 
10 5
1 4 5 6 10 
12 3
7 8 9 
12 4
5 9 10 11 
12 7
4 5 6 7 8 10 12 
12 6
3 5 7 8 9 12 
12 6
1 3 4 7 8 11 
12 7
1 2 3 7 8 10 12 
12 7
2 4 5 6 7 9 10 
10 6
1 3 4 5 6 9 
11 6
3 5 ...

result:

ok 2000 lines

Test #9:

score: 100
Accepted
time: 1ms
memory: 3604kb

input:

1000
12 6
2 5 8 9 11 12
12 7
2 3 4 6 9 10 11
10 6
3 5 6 8 9 10
12 6
1 2 4 8 10 12
8 3
1 2 5
12 7
2 5 7 8 10 11 12
11 6
1 2 3 4 7 8
12 8
1 4 5 6 7 9 11 12
12 6
1 2 3 6 8 12
12 5
4 5 6 9 10
12 9
3 4 6 7 8 9 10 11 12
10 6
3 5 7 8 9 10
12 7
1 2 4 5 7 8 9
10 4
1 4 6 9
11 8
2 3 4 5 6 7 9 10
6 3
3 5 6
11 4...

output:

12 5
2 5 8 9 11 
12 8
2 3 4 6 9 10 11 12 
10 5
3 5 6 8 9 
12 5
1 2 4 8 10 
8 4
1 2 5 8 
12 6
2 5 7 8 10 11 
11 7
1 2 3 4 7 8 11 
12 7
1 4 5 6 7 9 11 
12 5
1 2 3 6 8 
12 6
4 5 6 9 10 12 
12 8
3 4 6 7 8 9 10 11 
10 5
3 5 7 8 9 
12 8
1 2 4 5 7 8 9 12 
10 5
1 4 6 9 10 
11 9
2 3 4 5 6 7 9 10 11 
6 2
3 5 ...

input:

1000
12 5
2 5 8 9 11
12 8
2 3 4 6 9 10 11 12
10 5
3 5 6 8 9
12 5
1 2 4 8 10
8 4
1 2 5 8
12 6
2 5 7 8 10 11
11 7
1 2 3 4 7 8 11
12 7
1 4 5 6 7 9 11
12 5
1 2 3 6 8
12 6
4 5 6 9 10 12
12 8
3 4 6 7 8 9 10 11
10 5
3 5 7 8 9
12 8
1 2 4 5 7 8 9 12
10 5
1 4 6 9 10
11 9
2 3 4 5 6 7 9 10 11
6 2
3 5
11 5
2 3 6...

output:

12 6
2 5 8 9 11 12 
12 7
2 3 4 6 9 10 11 
10 6
3 5 6 8 9 10 
12 6
1 2 4 8 10 12 
8 3
1 2 5 
12 7
2 5 7 8 10 11 12 
11 6
1 2 3 4 7 8 
12 8
1 4 5 6 7 9 11 12 
12 6
1 2 3 6 8 12 
12 5
4 5 6 9 10 
12 9
3 4 6 7 8 9 10 11 12 
10 6
3 5 7 8 9 10 
12 7
1 2 4 5 7 8 9 
10 4
1 4 6 9 
11 8
2 3 4 5 6 7 9 10 
6 3
...

result:

ok 2000 lines

Test #10:

score: 100
Accepted
time: 1ms
memory: 3616kb

input:

1000
7 4
1 2 4 7
12 8
2 3 4 5 6 8 10 11
11 8
1 2 4 6 7 8 9 11
11 5
2 3 5 7 9
12 3
4 7 8
11 4
6 8 10 11
12 7
1 3 6 7 8 9 12
11 6
4 5 6 8 9 11
8 2
1 4
10 4
1 3 4 10
12 7
1 2 3 5 8 11 12
12 5
2 3 5 8 9
10 5
1 2 4 5 7
12 4
3 8 9 10
12 6
4 5 6 8 9 12
8 4
1 4 5 6
12 3
5 6 11
6 4
1 3 5 6
12 8
1 3 4 5 6 7 8...

output:

7 3
1 2 4 
12 9
2 3 4 5 6 8 10 11 12 
11 7
1 2 4 6 7 8 9 
11 6
2 3 5 7 9 11 
12 4
4 7 8 12 
11 3
6 8 10 
12 6
1 3 6 7 8 9 
11 5
4 5 6 8 9 
8 3
1 4 8 
10 3
1 3 4 
12 6
1 2 3 5 8 11 
12 6
2 3 5 8 9 12 
10 6
1 2 4 5 7 10 
12 5
3 8 9 10 12 
12 5
4 5 6 8 9 
8 5
1 4 5 6 8 
12 4
5 6 11 12 
6 3
1 3 5 
12 9
...

input:

1000
7 3
1 2 4
12 9
2 3 4 5 6 8 10 11 12
11 7
1 2 4 6 7 8 9
11 6
2 3 5 7 9 11
12 4
4 7 8 12
11 3
6 8 10
12 6
1 3 6 7 8 9
11 5
4 5 6 8 9
8 3
1 4 8
10 3
1 3 4
12 6
1 2 3 5 8 11
12 6
2 3 5 8 9 12
10 6
1 2 4 5 7 10
12 5
3 8 9 10 12
12 5
4 5 6 8 9
8 5
1 4 5 6 8
12 4
5 6 11 12
6 3
1 3 5
12 9
1 3 4 5 6 7 8...

output:

7 4
1 2 4 7 
12 8
2 3 4 5 6 8 10 11 
11 8
1 2 4 6 7 8 9 11 
11 5
2 3 5 7 9 
12 3
4 7 8 
11 4
6 8 10 11 
12 7
1 3 6 7 8 9 12 
11 6
4 5 6 8 9 11 
8 2
1 4 
10 4
1 3 4 10 
12 7
1 2 3 5 8 11 12 
12 5
2 3 5 8 9 
10 5
1 2 4 5 7 
12 4
3 8 9 10 
12 6
4 5 6 8 9 12 
8 4
1 4 5 6 
12 3
5 6 11 
6 4
1 3 5 6 
12 8
...

result:

ok 2000 lines

Test #11:

score: 100
Accepted
time: 1ms
memory: 3788kb

input:

1000
10 5
1 2 3 4 5
12 5
1 5 6 10 12
12 7
1 2 7 8 9 11 12
12 5
6 7 8 9 10
12 6
2 3 4 5 9 12
11 4
1 3 6 10
10 3
1 5 6
12 5
2 3 4 9 11
12 5
1 3 7 10 12
12 8
1 2 3 4 6 7 9 10
10 4
1 2 8 9
12 7
1 2 5 7 8 9 10
11 5
1 8 9 10 11
11 5
3 4 7 8 10
12 7
3 5 6 7 10 11 12
9 3
3 4 6
12 4
4 5 8 9
12 8
1 3 4 6 8 9 ...

output:

10 6
1 2 3 4 5 10 
12 4
1 5 6 10 
12 6
1 2 7 8 9 11 
12 6
6 7 8 9 10 12 
12 5
2 3 4 5 9 
11 5
1 3 6 10 11 
10 4
1 5 6 10 
12 6
2 3 4 9 11 12 
12 4
1 3 7 10 
12 9
1 2 3 4 6 7 9 10 12 
10 5
1 2 8 9 10 
12 8
1 2 5 7 8 9 10 12 
11 4
1 8 9 10 
11 6
3 4 7 8 10 11 
12 6
3 5 6 7 10 11 
9 4
3 4 6 9 
12 5
4 5...

input:

1000
10 6
1 2 3 4 5 10
12 4
1 5 6 10
12 6
1 2 7 8 9 11
12 6
6 7 8 9 10 12
12 5
2 3 4 5 9
11 5
1 3 6 10 11
10 4
1 5 6 10
12 6
2 3 4 9 11 12
12 4
1 3 7 10
12 9
1 2 3 4 6 7 9 10 12
10 5
1 2 8 9 10
12 8
1 2 5 7 8 9 10 12
11 4
1 8 9 10
11 6
3 4 7 8 10 11
12 6
3 5 6 7 10 11
9 4
3 4 6 9
12 5
4 5 8 9 12
12 ...

output:

10 5
1 2 3 4 5 
12 5
1 5 6 10 12 
12 7
1 2 7 8 9 11 12 
12 5
6 7 8 9 10 
12 6
2 3 4 5 9 12 
11 4
1 3 6 10 
10 3
1 5 6 
12 5
2 3 4 9 11 
12 5
1 3 7 10 12 
12 8
1 2 3 4 6 7 9 10 
10 4
1 2 8 9 
12 7
1 2 5 7 8 9 10 
11 5
1 8 9 10 11 
11 5
3 4 7 8 10 
12 7
3 5 6 7 10 11 12 
9 3
3 4 6 
12 4
4 5 8 9 
12 8
...

result:

ok 2000 lines

Test #12:

score: 100
Accepted
time: 1ms
memory: 3836kb

input:

1000
12 6
3 5 6 10 11 12
8 5
1 3 5 7 8
12 3
5 8 11
12 6
1 5 8 10 11 12
12 10
1 3 5 6 7 8 9 10 11 12
12 5
1 6 8 10 11
12 9
3 4 5 6 7 9 10 11 12
12 6
1 3 4 8 10 11
8 1
6
12 7
2 3 5 8 10 11 12
11 4
4 8 9 10
10 6
1 3 4 5 8 10
12 3
3 11 12
12 5
2 5 6 7 10
11 6
1 3 5 6 9 11
8 3
3 7 8
9 3
2 4 5
8 5
3 5 6 7...

output:

12 5
3 5 6 10 11 
8 4
1 3 5 7 
12 4
5 8 11 12 
12 5
1 5 8 10 11 
12 9
1 3 5 6 7 8 9 10 11 
12 6
1 6 8 10 11 12 
12 8
3 4 5 6 7 9 10 11 
12 7
1 3 4 8 10 11 12 
8 2
6 8 
12 6
2 3 5 8 10 11 
11 5
4 8 9 10 11 
10 5
1 3 4 5 8 
12 2
3 11 
12 6
2 5 6 7 10 12 
11 5
1 3 5 6 9 
8 2
3 7 
9 4
2 4 5 9 
8 4
3 5 6...

input:

1000
12 5
3 5 6 10 11
8 4
1 3 5 7
12 4
5 8 11 12
12 5
1 5 8 10 11
12 9
1 3 5 6 7 8 9 10 11
12 6
1 6 8 10 11 12
12 8
3 4 5 6 7 9 10 11
12 7
1 3 4 8 10 11 12
8 2
6 8
12 6
2 3 5 8 10 11
11 5
4 8 9 10 11
10 5
1 3 4 5 8
12 2
3 11
12 6
2 5 6 7 10 12
11 5
1 3 5 6 9
8 2
3 7
9 4
2 4 5 9
8 4
3 5 6 7
11 4
2 4 ...

output:

12 6
3 5 6 10 11 12 
8 5
1 3 5 7 8 
12 3
5 8 11 
12 6
1 5 8 10 11 12 
12 10
1 3 5 6 7 8 9 10 11 12 
12 5
1 6 8 10 11 
12 9
3 4 5 6 7 9 10 11 12 
12 6
1 3 4 8 10 11 
8 1
6 
12 7
2 3 5 8 10 11 12 
11 4
4 8 9 10 
10 6
1 3 4 5 8 10 
12 3
3 11 12 
12 5
2 5 6 7 10 
11 6
1 3 5 6 9 11 
8 3
3 7 8 
9 3
2 4 5 ...

result:

ok 2000 lines

Test #13:

score: 100
Accepted
time: 1ms
memory: 3616kb

input:

1000
11 5
2 3 4 10 11
6 2
1 6
12 7
2 3 4 7 8 10 12
11 5
2 4 6 8 9
6 4
1 3 4 6
10 5
4 6 7 8 10
11 3
6 7 9
12 4
3 6 9 11
11 7
1 3 4 5 6 10 11
12 7
2 3 5 9 10 11 12
10 7
1 2 3 4 5 8 10
11 2
2 3
11 4
5 6 8 10
10 2
6 7
11 5
2 6 8 10 11
10 4
2 3 7 9
12 5
1 5 7 9 11
12 4
3 5 6 7
12 7
2 3 5 7 8 11 12
12 9
1...

output:

11 4
2 3 4 10 
6 1
1 
12 6
2 3 4 7 8 10 
11 6
2 4 6 8 9 11 
6 3
1 3 4 
10 4
4 6 7 8 
11 4
6 7 9 11 
12 5
3 6 9 11 12 
11 6
1 3 4 5 6 10 
12 6
2 3 5 9 10 11 
10 6
1 2 3 4 5 8 
11 3
2 3 11 
11 5
5 6 8 10 11 
10 3
6 7 10 
11 4
2 6 8 10 
10 5
2 3 7 9 10 
12 6
1 5 7 9 11 12 
12 5
3 5 6 7 12 
12 6
2 3 5 7...

input:

1000
11 4
2 3 4 10
6 1
1
12 6
2 3 4 7 8 10
11 6
2 4 6 8 9 11
6 3
1 3 4
10 4
4 6 7 8
11 4
6 7 9 11
12 5
3 6 9 11 12
11 6
1 3 4 5 6 10
12 6
2 3 5 9 10 11
10 6
1 2 3 4 5 8
11 3
2 3 11
11 5
5 6 8 10 11
10 3
6 7 10
11 4
2 6 8 10
10 5
2 3 7 9 10
12 6
1 5 7 9 11 12
12 5
3 5 6 7 12
12 6
2 3 5 7 8 11
12 8
1 ...

output:

11 5
2 3 4 10 11 
6 2
1 6 
12 7
2 3 4 7 8 10 12 
11 5
2 4 6 8 9 
6 4
1 3 4 6 
10 5
4 6 7 8 10 
11 3
6 7 9 
12 4
3 6 9 11 
11 7
1 3 4 5 6 10 11 
12 7
2 3 5 9 10 11 12 
10 7
1 2 3 4 5 8 10 
11 2
2 3 
11 4
5 6 8 10 
10 2
6 7 
11 5
2 6 8 10 11 
10 4
2 3 7 9 
12 5
1 5 7 9 11 
12 4
3 5 6 7 
12 7
2 3 5 7 8...

result:

ok 2000 lines

Test #14:

score: 100
Accepted
time: 1ms
memory: 3644kb

input:

190
12 5
2 3 5 6 12
8 4
3 4 6 7
11 6
1 3 4 9 10 11
10 3
6 9 10
12 4
1 7 8 10
7 3
5 6 7
12 4
1 2 6 9
9 3
1 3 5
12 6
2 5 8 9 10 12
9 5
1 2 4 6 7
12 4
3 7 9 12
11 7
1 3 4 6 7 10 11
10 7
1 2 3 4 7 9 10
12 3
5 7 12
11 7
3 5 6 7 8 9 10
10 3
3 4 6
11 5
1 2 8 10 11
11 8
1 5 6 7 8 9 10 11
12 9
1 2 3 6 7 8 9 ...

output:

12 4
2 3 5 6 
8 5
3 4 6 7 8 
11 5
1 3 4 9 10 
10 2
6 9 
12 5
1 7 8 10 12 
7 2
5 6 
12 5
1 2 6 9 12 
9 4
1 3 5 9 
12 5
2 5 8 9 10 
9 6
1 2 4 6 7 9 
12 3
3 7 9 
11 6
1 3 4 6 7 10 
10 6
1 2 3 4 7 9 
12 2
5 7 
11 8
3 5 6 7 8 9 10 11 
10 4
3 4 6 10 
11 4
1 2 8 10 
11 7
1 5 6 7 8 9 10 
12 8
1 2 3 6 7 8 9 ...

input:

190
12 4
2 3 5 6
8 5
3 4 6 7 8
11 5
1 3 4 9 10
10 2
6 9
12 5
1 7 8 10 12
7 2
5 6
12 5
1 2 6 9 12
9 4
1 3 5 9
12 5
2 5 8 9 10
9 6
1 2 4 6 7 9
12 3
3 7 9
11 6
1 3 4 6 7 10
10 6
1 2 3 4 7 9
12 2
5 7
11 8
3 5 6 7 8 9 10 11
10 4
3 4 6 10
11 4
1 2 8 10
11 7
1 5 6 7 8 9 10
12 8
1 2 3 6 7 8 9 11
10 6
2 3 5 ...

output:

12 5
2 3 5 6 12 
8 4
3 4 6 7 
11 6
1 3 4 9 10 11 
10 3
6 9 10 
12 4
1 7 8 10 
7 3
5 6 7 
12 4
1 2 6 9 
9 3
1 3 5 
12 6
2 5 8 9 10 12 
9 5
1 2 4 6 7 
12 4
3 7 9 12 
11 7
1 3 4 6 7 10 11 
10 7
1 2 3 4 7 9 10 
12 3
5 7 12 
11 7
3 5 6 7 8 9 10 
10 3
3 4 6 
11 5
1 2 8 10 11 
11 8
1 5 6 7 8 9 10 11 
12 9
...

result:

ok 380 lines

Test #15:

score: 100
Accepted
time: 1ms
memory: 3820kb

input:

1000
12 4
5 6 8 9
12 6
1 5 6 7 9 10
12 12
1 2 3 4 5 6 7 8 9 10 11 12
12 12
1 2 3 4 5 6 7 8 9 10 11 12
12 9
1 2 4 5 6 8 9 10 11
12 7
2 6 7 8 9 10 11
12 11
1 2 3 5 6 7 8 9 10 11 12
12 1
1
12 8
1 3 4 8 9 10 11 12
12 8
1 2 3 4 5 8 9 11
12 4
3 4 7 10
12 8
1 2 4 6 8 9 10 11
12 3
1 5 6
12 6
2 3 4 6 8 10
12...

output:

12 5
5 6 8 9 12 
12 7
1 5 6 7 9 10 12 
12 11
1 2 3 4 5 6 7 8 9 10 11 
12 11
1 2 3 4 5 6 7 8 9 10 11 
12 10
1 2 4 5 6 8 9 10 11 12 
12 8
2 6 7 8 9 10 11 12 
12 10
1 2 3 5 6 7 8 9 10 11 
12 2
1 12 
12 7
1 3 4 8 9 10 11 
12 9
1 2 3 4 5 8 9 11 12 
12 5
3 4 7 10 12 
12 9
1 2 4 6 8 9 10 11 12 
12 4
1 5 6 ...

input:

1000
12 5
5 6 8 9 12
12 7
1 5 6 7 9 10 12
12 11
1 2 3 4 5 6 7 8 9 10 11
12 11
1 2 3 4 5 6 7 8 9 10 11
12 10
1 2 4 5 6 8 9 10 11 12
12 8
2 6 7 8 9 10 11 12
12 10
1 2 3 5 6 7 8 9 10 11
12 2
1 12
12 7
1 3 4 8 9 10 11
12 9
1 2 3 4 5 8 9 11 12
12 5
3 4 7 10 12
12 9
1 2 4 6 8 9 10 11 12
12 4
1 5 6 12
12 7...

output:

12 4
5 6 8 9 
12 6
1 5 6 7 9 10 
12 12
1 2 3 4 5 6 7 8 9 10 11 12 
12 12
1 2 3 4 5 6 7 8 9 10 11 12 
12 9
1 2 4 5 6 8 9 10 11 
12 7
2 6 7 8 9 10 11 
12 11
1 2 3 5 6 7 8 9 10 11 12 
12 1
1 
12 8
1 3 4 8 9 10 11 12 
12 8
1 2 3 4 5 8 9 11 
12 4
3 4 7 10 
12 8
1 2 4 6 8 9 10 11 
12 3
1 5 6 
12 6
2 3 4 6...

result:

ok 2000 lines

Test #16:

score: 100
Accepted
time: 1ms
memory: 3604kb

input:

1000
15 9
2 3 4 5 7 10 12 13 14
15 4
1 7 8 11
15 5
5 6 7 11 15
15 0
15 11
1 4 6 7 8 9 10 12 13 14 15
15 4
4 5 13 14
15 12
1 2 3 4 6 7 9 11 12 13 14 15
15 12
1 2 3 4 5 8 9 10 11 12 13 15
15 1
13
15 13
1 3 4 5 6 7 8 9 10 12 13 14 15
15 7
2 4 8 9 10 12 14
15 6
1 9 11 12 13 15
15 1
11
15 4
1 6 11 14
15 ...

output:

15 10
2 3 4 5 7 10 12 13 14 15 
15 5
1 7 8 11 15 
15 4
5 6 7 11 
15 1
15 
15 10
1 4 6 7 8 9 10 12 13 14 
15 5
4 5 13 14 15 
15 11
1 2 3 4 6 7 9 11 12 13 14 
15 11
1 2 3 4 5 8 9 10 11 12 13 
15 2
13 15 
15 12
1 3 4 5 6 7 8 9 10 12 13 14 
15 8
2 4 8 9 10 12 14 15 
15 5
1 9 11 12 13 
15 2
11 15 
15 5
1...

input:

1000
15 10
2 3 4 5 7 10 12 13 14 15
15 5
1 7 8 11 15
15 4
5 6 7 11
15 1
15
15 10
1 4 6 7 8 9 10 12 13 14
15 5
4 5 13 14 15
15 11
1 2 3 4 6 7 9 11 12 13 14
15 11
1 2 3 4 5 8 9 10 11 12 13
15 2
13 15
15 12
1 3 4 5 6 7 8 9 10 12 13 14
15 8
2 4 8 9 10 12 14 15
15 5
1 9 11 12 13
15 2
11 15
15 5
1 6 11 14...

output:

15 9
2 3 4 5 7 10 12 13 14 
15 4
1 7 8 11 
15 5
5 6 7 11 15 
15 0

15 11
1 4 6 7 8 9 10 12 13 14 15 
15 4
4 5 13 14 
15 12
1 2 3 4 6 7 9 11 12 13 14 15 
15 12
1 2 3 4 5 8 9 10 11 12 13 15 
15 1
13 
15 13
1 3 4 5 6 7 8 9 10 12 13 14 15 
15 7
2 4 8 9 10 12 14 
15 6
1 9 11 12 13 15 
15 1
11 
15 4
1 6 1...

result:

ok 1999 lines

Test #17:

score: 100
Accepted
time: 1ms
memory: 3532kb

input:

1000
20 15
2 3 4 6 7 8 9 10 11 13 14 15 18 19 20
20 13
1 2 4 8 9 10 11 12 13 14 15 17 19
20 11
1 2 3 5 7 9 10 11 14 16 18
20 2
9 15
20 3
10 13 17
20 14
1 2 3 4 6 10 12 13 14 15 16 17 19 20
20 13
1 3 4 6 7 8 9 10 13 15 16 19 20
20 14
1 3 4 5 6 7 9 10 13 15 16 17 19 20
20 4
2 11 14 16
20 2
6 9
20 9
3 ...

output:

20 14
2 3 4 6 7 8 9 10 11 13 14 15 18 19 
20 14
1 2 4 8 9 10 11 12 13 14 15 17 19 20 
20 12
1 2 3 5 7 9 10 11 14 16 18 20 
20 3
9 15 20 
20 4
10 13 17 20 
20 13
1 2 3 4 6 10 12 13 14 15 16 17 19 
20 12
1 3 4 6 7 8 9 10 13 15 16 19 
20 13
1 3 4 5 6 7 9 10 13 15 16 17 19 
20 5
2 11 14 16 20 
20 3
6 9 ...

input:

1000
20 14
2 3 4 6 7 8 9 10 11 13 14 15 18 19
20 14
1 2 4 8 9 10 11 12 13 14 15 17 19 20
20 12
1 2 3 5 7 9 10 11 14 16 18 20
20 3
9 15 20
20 4
10 13 17 20
20 13
1 2 3 4 6 10 12 13 14 15 16 17 19
20 12
1 3 4 6 7 8 9 10 13 15 16 19
20 13
1 3 4 5 6 7 9 10 13 15 16 17 19
20 5
2 11 14 16 20
20 3
6 9 20
2...

output:

20 15
2 3 4 6 7 8 9 10 11 13 14 15 18 19 20 
20 13
1 2 4 8 9 10 11 12 13 14 15 17 19 
20 11
1 2 3 5 7 9 10 11 14 16 18 
20 2
9 15 
20 3
10 13 17 
20 14
1 2 3 4 6 10 12 13 14 15 16 17 19 20 
20 13
1 3 4 6 7 8 9 10 13 15 16 19 20 
20 14
1 3 4 5 6 7 9 10 13 15 16 17 19 20 
20 4
2 11 14 16 
20 2
6 9 
20...

result:

ok 1999 lines

Test #18:

score: 100
Accepted
time: 2ms
memory: 3832kb

input:

1000
30 1
22
30 12
1 4 6 7 11 13 19 20 22 25 26 29
30 11
2 11 12 15 17 19 22 24 26 28 30
30 0
30 2
7 25
30 26
1 2 3 4 6 8 9 10 11 12 13 14 15 17 18 19 20 21 22 23 24 25 26 27 28 30
30 26
1 2 3 4 5 7 9 10 11 12 13 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
30 27
1 2 3 4 6 7 8 9 11 12 13 14 15 16 17...

output:

30 2
22 30 
30 13
1 4 6 7 11 13 19 20 22 25 26 29 30 
30 10
2 11 12 15 17 19 22 24 26 28 
30 1
30 
30 3
7 25 30 
30 25
1 2 3 4 6 8 9 10 11 12 13 14 15 17 18 19 20 21 22 23 24 25 26 27 28 
30 25
1 2 3 4 5 7 9 10 11 12 13 16 17 18 19 20 21 22 23 24 25 26 27 28 29 
30 26
1 2 3 4 6 7 8 9 11 12 13 14 15 ...

input:

1000
30 2
22 30
30 13
1 4 6 7 11 13 19 20 22 25 26 29 30
30 10
2 11 12 15 17 19 22 24 26 28
30 1
30
30 3
7 25 30
30 25
1 2 3 4 6 8 9 10 11 12 13 14 15 17 18 19 20 21 22 23 24 25 26 27 28
30 25
1 2 3 4 5 7 9 10 11 12 13 16 17 18 19 20 21 22 23 24 25 26 27 28 29
30 26
1 2 3 4 6 7 8 9 11 12 13 14 15 16...

output:

30 1
22 
30 12
1 4 6 7 11 13 19 20 22 25 26 29 
30 11
2 11 12 15 17 19 22 24 26 28 30 
30 0

30 2
7 25 
30 26
1 2 3 4 6 8 9 10 11 12 13 14 15 17 18 19 20 21 22 23 24 25 26 27 28 30 
30 26
1 2 3 4 5 7 9 10 11 12 13 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 
30 27
1 2 3 4 6 7 8 9 11 12 13 14 15 16 ...

result:

ok 2000 lines

Test #19:

score: 0
Wrong Answer on the first run

input:

1000
40 4
3 18 23 36
40 28
1 2 3 4 6 8 9 10 12 13 14 18 19 20 21 22 24 26 28 29 31 32 34 35 36 37 38 39
40 36
1 2 3 4 6 7 8 9 10 11 12 13 15 16 17 18 19 20 21 22 23 25 27 28 29 30 31 32 33 34 35 36 37 38 39 40
40 18
2 4 5 10 13 15 16 21 23 24 26 27 29 32 34 37 38 39
40 33
1 2 3 4 5 6 8 9 10 12 13 16...

output:

40 5
3 4 8 18 23 
40 52
1 3 4 6 8 11 12 13 14 18 19 20 21 22 24 26 28 29 31 32 33 34 35 36 37 38 39 40 
40 54
2 3 4 6 7 14 15 16 17 18 19 20 21 22 23 25 27 28 29 30 31 32 33 34 35 36 37 38 39 40 
40 45
3 4 10 13 15 16 21 23 24 26 27 29 32 33 34 35 36 37 38 39 40 
40 56
2 3 4 5 6 8 11 12 13 16 17 19 ...

input:


output:


result:

wrong answer Integer parameter [name=k2] equals to 52, violates the range [0, 40] (test case 2)