簽到題
因爲一個小細節考慮不到wa了兩次
// 一開始沒這個if wa了。因爲數據中存在同一幀(frame)一個相同的值出現多次,這樣子同一個i 後面的同樣的特徵會把len重置爲1
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int t;
int n;
struct val
{
int last;
int len;
void update(int t)
{
if (t == last + 1)
++len;
else if (t > last + 1) // 一開始沒這個if wa了。因爲數據中存在同一幀(frame)一個相同的值出現多次,這樣子同一個i 後面的同樣的特徵會把len重置爲1
len = 1;
last = t;
}
};
void work()
{
cin >> n;
map<pair<ll,ll>, val> m;
int k;
ll x,y;
int ans = 0;
for (int i = 1; i <= n; ++i)
{
cin >> k;
for (int j = 0; j < k; ++j)
{
cin >> x >> y;
auto it = m.find(pair<ll,ll>(x,y));
if (it == m.end())
{
m[pair<ll,ll>(x,y)] = val{i,1};
ans = max(ans,1);
}
else
{
it->second.update(i);
ans = max(ans,it->second.len);
}
}
}
cout << ans << endl;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cin >> t;
while (t--)
work();
return 0;
}