Compare commits

..

No commits in common. "e48cc83bfb3051722e188ef7002d9b5eeb3e107c" and "c96882f67e87b0174c360bde27137b7cb2a40af3" have entirely different histories.

2 changed files with 0 additions and 55 deletions

View File

@ -1,5 +1,3 @@
# 算法笔记
## P6476 题解易错点
@ -8,11 +6,6 @@
2. **清空操作优化**每次使用后需要清空tot数组但直接memset会超时改用标记数组记录修改位置
3. **下标偏移**结构体T使用of常量处理负数下标数组大小需要*2
4. **状态转移公式**注意容斥原理的应用dp[i][j] = 当前三元组数 + 子区间累计值 - 重复部分
## 找规律
* 列出所有规则
* 模拟所有样例
* 样例不够自己凑
## 线性动态规划优化为$O(n\log{n})$方法
>如果是递增序列就lower_bound

View File

@ -1,48 +0,0 @@
#include <algorithm>
#include <cstdint>
#include <iostream>
#include <istream>
using ll = int64_t;
const ll maxn = 1e5+7;
struct S{
ll c,t;
inline bool operator<(const S&other)const{
return t<other.t;
}
}h[maxn],l[maxn];
ll n,m,q;
static inline void solve(){
std::cin>>n>>m>>q;
for(ll i=1;i<=n;i++)h[i]={0,0};
for(ll i=1;i<=m;i++)l[i]={0,0};
for(ll i=1;i<=q;i++){
ll opt,x,c;
std::cin>>opt>>x>>c;
if(opt==0){
h[x]={c,i};
}else{
l[x]={c,i};
}
}
for(ll i=1;i<=n;i++){
for(ll j=1;j<=m;j++){
if(h[i].c==0&&l[j].c==0){
std::cout<<"0 ";
continue;
}
std::cout<<std::max(h[i],l[j]).c<<" ";
}
std::cout<<"\n";
}
}
int main(){
std::iostream::sync_with_stdio(false);
std::cin.tie(nullptr);
ll T;
std::cin>>T;
while(T--)solve();
}