Codeforces 1330 A. Dreamoon and Ranking Collection_数组

题意:

已知过去 Codeforces 1330 A. Dreamoon and Ranking Collection_数组_02 场比赛的排名,还可以再参加 Codeforces 1330 A. Dreamoon and Ranking Collection_数组_03 场,问从 Codeforces 1330 A. Dreamoon and Ranking Collection_数组_04 起可能获得的最长连续名次序列。
记录已经获得的名次,从 Codeforces 1330 A. Dreamoon and Ranking Collection_数组_04

这道题又犯了那个低级错误,数组开到 Codeforces 1330 A. Dreamoon and Ranking Collection_数组_06 循环到了 Codeforces 1330 A. Dreamoon and Ranking Collection_数组_07

AC代码:

const int N = 1010;
int n, m, k, x;
int ans, res, tmp, cnt, pos;
bool vis[N];

int main()
{
int t;
sd(t);
while (t--)
{
mem(vis, 0);
sdd(n, x);
rep(i, 1, n)
{
sd(k);
vis[k] = 1;
}
ans = 1;
rep(i, 1, 500)
{
if (x == 0 && vis[i] == 0)
break;
ans = i;
if (!vis[i])
x--;
}
pd(ans);
}
return 0;
}