首页 > TAG信息列表 > ural

Subpalindromes URAL - 1989 (字符串hash+线段树)

题目链接 题意:给定一个小写字母组成的字符串,m次操作,每次修改单个位置的字符或者查询[l,r]这段子串是否是回文串,给出Yes/No 思路:输入字符串s0,设字符串的逆序串为s1。 如果这题没有单点修改的话,直接对s0 s1求出hash数组,然后对于[l,r]判断左边区间的hash值是否等于右半区间的ha

[ural 2121]. Intersection of Parabolas

题意 给出一个整数\(a\),给出两个抛物线\(y = (x - a) ^ 2\)和\(x = (y - a) ^ 2\)。 求两个曲线围成的面积。 \(1 \leq a \leq {10} ^ {18}\)。 题解 开始感觉就是一道积分题。 显然该函数图像可以分三段来积分。 然后写了个shit长的牛迭+积分。 然后发现它不仅爆精了,还T了。 诶,等

[ural 2126]. Partition into Teams

题意 \(n\)个人,每个人可以站红队,可以站蓝队,也可以当观察者。 红队获胜当且仅当站红队的人数大于站蓝队的人数。 问红队获胜的方案数,对小质数\(p\)取模。 \(n \leq {10} ^ {18}, p \leq {10} ^ {6}\)。 题解 列出式子: \[ \sum_{i = 0} ^ n \binom{n}{i} \sum_{j = 0} ^ {\lfloor \f

[ural 2124]. Algebra on Segment

题意 给出一个模\(p\)(\(p\)是素数)意义下的序列,支持两种操作: 区间乘一个数; 询问一个区间的元素构成的群的大小。 保证序列中的数时时刻刻不为\(0\)。 题解 一道好题……sb了好久。 第一个想法显然是先找到一个原根\(g\),再取指标进行运算。 然后对于一个区间\(g ^ {k_l}, g ^ {k_{

URAL - 1989 【线段树||树状数组 Hash 回文串】

URAL - 1989 【线段树||树状数组 Hash 回文串】 题目链接 题目描述:给你一个字符串(|s|<=1e5),有Q次询问,1可以单点修改字符,2或者给你区间L,R,问你这个字串是不是回文串。(Q<=1e5) 思路:暴力必然超时。如果没有点修改,怎么快速判断子串是不是回文串?当然是hash了,类似于一个前缀和的

Ural 1250 Sea Burial 题解

目录 Ural 1250 Sea Burial 题解 题意 输入及数据范围 题解 程序 Ural 1250 Sea Burial 题解 题意 给定一个\(n\times m\)的地图,\(.\)为水,\(\#\)为陆,地图的外部是水(地图被水包围)。水为八连通,陆为四联通。联通的水称为海,联通的陆称为岛。海内可能有岛,岛内可能有海。给定\(x

G - 炎之箭 (URAL - 1073 )

There live square people in a square country. Everything in this country is square also. Thus, the Square Parliament has passed a law about a land. According to the law each citizen of the country has a right to buy land. A land is sold in squares, surely

D - 水之矢 (URAL - 1353 )

Vasya is the beginning mathematician. He decided to make an important contribution to the science and to become famous all over the world. But how can he do that if the most interesting facts such as Pythagor’s theorem are already proved? Correct! He is t

URAL 1416. Confidential

1416. Confidential Time limit: 2.0 second Memory limit: 64 MB Zaphod Beeblebrox — President of the Imperial Galactic Government. And by chance he is an owner of enterprises that trade in secondhand pens. This is a complicated highly protable and highly

URAL 1182. Team Them Up!

1182. Team Them Up! Time limit: 1.0 second Memory limit: 64 MB Your task is to divide a number of persons into two teams, in such a way, that: everyone belongs to one of the teams; every team has at least one member; every person in the team knows every

URAL 1056. Computer Net

1056. Computer Net Time limit: 2.0 second Memory limit: 64 MB Background Computer net is created by consecutive computer plug-up to one that has already been connected to the net. Each new computer gets an ordinal number, but the protocol contains the n

A - Subpalindromes URAL - 1989 (线段树)

一个字符串可以表示为: ,故当哈希冲突率低的时候,可以将字符串唯一表示为一个数字,本题线段树就是维护区间和。 #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #include<iostream> #include<queue> #include<stack> using namespace std; const in