维护每一行、每一列最后一次染色时染上的颜色以及时间戳即可。
时间复杂度 O ( T n ) O(Tn) O(Tn)。
#include <bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
struct node{
int c,t;}a[maxn],b[maxn]
维护每一行、每一列最后一次染色时染上的颜色以及时间戳即可。
时间复杂度 O ( T n ) O(Tn) O(Tn)。
#include <bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
struct node{
int c,t;}a[maxn],b[maxn]