QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#295296 | #4825. Even and Odd Combinations | ucup-team1134# | 0 | 0ms | 3796kb | C++20 | 1.4kb | 2023-12-31 02:11:41 | 2023-12-31 02:11:42 |
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";
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";
for(int i=0;i<si(ans);i++){
if(i) cout<<" ";
cout<<ans[i];
}
cout<<"\n";
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3796kb
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 8th lines differ - expected: '1', found: '3'