QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#295297#4825. Even and Odd Combinationsucup-team1134#0 0ms3848kbC++201.5kb2023-12-31 02:13:492023-12-31 02:13:50

Judging History

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

  • [2023-12-31 02:13:50]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:3848kb
  • [2023-12-31 02:13:49]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=300005,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int Q;cin>>Q;
    while(Q--){
        ll N,K;cin>>N>>K;
        vector<ll> A(N+1);
        for(int i=1;i<=K;i++){
            int x;cin>>x;
            A[i]=x;
        }
        if(N&1){
            vector<int> ans;
            for(int i=1;i<=N;i++) if(!A[i]) ans.push_back(i);
            cout<<N<<" "<<si(ans)<<"\n";
            if(si(ans)){
                for(int i=0;i<si(ans);i++){
                    if(i) cout<<" ";
                    cout<<ans[i];
                }
                cout<<"\n";
            }
        }else{
            vector<int> ans;
            if(A[1]) ans.push_back(1);
            for(int i=2;i<=N;i++) if(!A[i]) ans.push_back(i);
            cout<<N<<" "<<si(ans)<<"\n";
            if(si(ans)){
                for(int i=0;i<si(ans);i++){
                    if(i) cout<<" ";
                    cout<<ans[i];
                }
                cout<<"\n";
            }
        }
    }
}


詳細信息

Test #1:

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

input:

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

output:

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

input:

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

output:

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

result:

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