就是这题,这是比赛时打的 70 分的代码。
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 2e2 + 5;
const int M = 2e4 + 5;
int t,n,m,a[N][M],cnt,x,y;
signed main()
{
cin >> t;
while (t--)
{
memset(a,0,sizeof(a));
cnt = 0;
cin >> n >> m;
while (m--)
{
cin >> x >> y;
if (!a[x][y])
{
a[x][y]++;
cnt++;
}
}
if (cnt < n * 2 - 3)
cout << "No" << endl;
else
cout << "Yes" << endl;
}
return 0;
}
这有道理吗?