维护每一行、每一列最后一次染色时染上的颜色以及时间戳即可。
时间复杂度 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(Tn)。
维护每一行、每一列最后一次染色时染上的颜色以及时间戳即可。
时间复杂度 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]
597
1007
202

被折叠的 条评论
为什么被折叠?