p9117专题

P9117 [春季测试 2023] 涂色游戏

Portal. 维护每一行、每一列最后一次染色时染上的颜色以及时间戳即可。 时间复杂度 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];void solve(){int n,m,q;c