QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#437302#4825. Even and Odd Combinationsbiank230 0ms3608kbC++141.4kb2024-06-09 07:18:382024-06-09 07:18:38

Judging History

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

  • [2024-06-09 07:18:38]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:3608kb
  • [2024-06-09 07:18:38]
  • 提交

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<<' ';
    }
    
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3608kb

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:

wrong answer 2nd lines differ - expected: '', found: '2 1'