追不到北京的神仙小姐姐(话说北京的神仙小姐姐长的好像我女神啊,不知道她去P了还是去T了呢),我只能颓废做北京省选了。。。。。。
咳咳,上面那句话不能让我女神看到。
题面
https://www.luogu.org/problem/P5460
题解
$[l,r]$变换了多少次等价于$[1,r]$-$[1,l-1]$,所以把所有的询问看成两个时间,离线处理。
把$trie$树看成线段树,相当于区间修改,单点查询。下传标记时,如果下面原来有标记,则失效。
#include<cstdio> #include<iostream> #include<cstring> #include<algorithm> using namespace std; struct node{ int ch[2],opt,add,v; } trie[3200050]; struct question{ int loc,time,ans,id; bool operator < (const question rhs) const { return time<rhs.time; } } a[200050]; bool cmp(question a,question b){ return a.id<b.id; } int n,q,cnt; char s[100050][5],x[100050][35],qes[100050][35]; void insert(int x,char *p) { if (*p=='