QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#296095#4825. Even and Odd Combinationsphtniit#0 0ms3748kbC++141.4kb2024-01-02 08:55:062024-01-02 08:55:06

Judging History

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

  • [2024-01-02 08:55:06]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:3748kb
  • [2024-01-02 08:55:06]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

typedef long double ldb;
typedef long long i64;
typedef unsigned long long u64;
typedef unsigned int u32;
typedef pair<int, int> pii;

// std::mt19937_64 rng(std::chrono::steady_clock::now().time_since_epoch().count());
// priority_queue<int, vector<int>, greater<int>> minq;
// ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
// fflush(stdout);

const int inf = 1000000007;
const i64 prm = 998244353;
const i64 inf2 = ((i64)inf) * inf;
const int maxn = 1100010; // 1.1e6

inline int read(){
  int x=0,f=0; char ch=getchar();
  while(!isdigit(ch)) f|=(ch==45),ch=getchar();
  while(isdigit(ch)) x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
  return f?-x:x;
}

void once() {
  int n = read();
  static int h, vis[55];
  h++;
  int k = read();
  for (int i = 0; i < k; ++i) {
    int p = read();
    vis[p] = h;
  }
  printf("%d ", n);
  if (n & 1) {
    printf("%d\n", n-k);
    for (int i = 1; i <= n; ++i) if (vis[i] != h) {
      printf("%d ", i);
    }
    puts("");
  } else {
    printf("%d\n", (vis[1] == h) + (n-1 - (k-vis[1]==h)));
    if (vis[1] == h) {
      printf("1 ");
    }
    for (int i = 2; i <= n; ++i) if (vis[i] != h) {
      printf("%d ", i);
    }
    puts("");
  }
}

int main() {
  int tes = 1;
  tes = read();
  while (tes--) {
    once();
  }
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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
1 3 
3 2
1 2 

input:

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

output:

3 0

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

result:

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