您当前的位置: 首页 > 

*DDL_GzmBlog

暂无认证

  • 0浏览

    0关注

    605博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

[Acwing] 142. 前缀统计 Tire_记录个数

*DDL_GzmBlog 发布时间:2022-04-16 16:49:14 ,浏览量:0

前言

传送门 :

思路

属于是 字典树 基础题,我们只需要在建树操作末尾的时候,记录一下个数即可

然后查询的时候加上

Mycode
// Problem: 前缀统计
// Contest: AcWing
// URL: https://www.acwing.com/problem/content/144/
// Memory Limit: 256 MB
// Time Limit: 1000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#include 
#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;
#define IOS  ios::sync_with_stdio(false);
#define CIT  cin.tie(0);
#define COT  cout.tie(0);

#define ll long long
#define x first
#define y second
#define pb push_back
#define endl '\n'
#define all(x) (x).begin(),x.end()
#define Fup(i,a,b) for(int i=a;i=b;i--)

typedef priority_queue  Pri_m;
typedef pair pii;
typedef vector VI;
map mp;
const int N = 1e6+10;
int cnt[N],trie[N][26],idx;
int n,m;

void add(string s){
	int u = 0 ;
	for(int i = 0 ; i n>>m;
	
	for(int i=1;i>s;
		add(s);
	}
	for(int i=1;i>s;
		cout            
关注
打赏
1657615554
查看更多评论
0.0431s