#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
int n;
cin >> n;
for (int i = 0; i < n; i++)
{
int k;
int num;
cin >> k >> num;
vector<int>p;
vector<int>q(k,0);
for (int j = 0; j < num; j++)
{
int a;
cin >> a;
p.push_back(a);
}
// cout << p.empty();
int time = 0;
while (true)
{
if (count(q.begin(),q.end(),0))
{
time += 1;
}
else
{
cout << time<<endl;
break;
}
for (int i = 0; i < p.size(); i++)
{
if (time == 1)
{
q[p[i] - 1] = 1;
}
else
{
if (p[i] - time >= 0)
{
q[p[i] - time] = 1;
}
if (p[i] -1+ time-1 < k)
{
q[p[i] - 1 + time - 1] = 1;
}
}
}
}
}
}
洛谷 Water The Garden
最新推荐文章于 2024-09-11 00:16:09 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)