xtu summer individual-4 D - Martian Strings】的更多相关文章

Martian Strings Time Limit: 2000ms Memory Limit: 262144KB This problem will be judged on CodeForces. Original ID: 149E64-bit integer IO format: %I64d      Java class name: (Any)   During the study of the Martians Petya clearly understood that the Mar…
正反两遍扩展KMP,维护公共长度为L时.出如今最左边和最右边的位置. . .. 然后枚举推断... E. Martian Strings time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output During the study of the Martians Petya clearly understood that the Mart…
Martian Strings 题解: 对于询问串, 我们可以从前往后先跑一遍exkmp. 然后在倒过来,从后往前跑一遍exkmp. 我们就可以记录下 对于每个正向匹配来说,最左边的点在哪里. 对于每个反向匹配来说,最右边的点在哪里. 然后判断可不可以构成这个串就好了. 代码: #include<bits/stdc++.h> using namespace std; #define Fopen freopen("_in.txt","r",stdin);…
Hometask Time Limit: 2000ms Memory Limit: 262144KB This problem will be judged on CodeForces. Original ID: 154A64-bit integer IO format: %I64d      Java class name: (Any)   Sergey attends lessons of the N-ish language. Each lesson he receives a homet…
题目大意 给定一个字符串T,接下来有n个字符串,对于每个字符串S,判断是否存在T[a-b]+T[c-d]=S(1 ≤ a ≤ b < c ≤ d ≤ length(T)) 题解 对于每个字符串S,我们先顺序在字符串T上进行匹配,并记录S的每个字符第一次在T上匹配到的位置(假设用数组pos记录),然后把字符串T和S都逆序,再用S在T上进行匹配,假设当前已经S匹配到第i个,在字符串T上的位置为j,S的第i+1个字符在原字符串中的位置为length(S)-i-2,T字符串的第j个字符在原字符串中的位置…
题目链接 给一个字符串s, n个字符串str. 令tmp为s中不重叠的两个连续子串合起来的结果, 顺序不能改变.问tmp能形成n个字符串中的几个. 初始将一个数组dp赋值为-1. 对str做kmp, 然后与串s进行匹配, 看哪些长度的串可以匹配到, 比如说匹配到了长度为j的串, 那么dp[j] = i, i是此时串s的位置. 然后将s和str都反转, 在做一次kmp, 在进行匹配, 对于匹配到的长度j, 看dp[lenStr-j]是否为-1, 如果不为-1, 看lenS-i是否大于等于dp[le…
Dancing Lessons Time Limit: 5000ms Memory Limit: 262144KB This problem will be judged on CodeForces. Original ID: 45C64-bit integer IO format: %I64d      Java class name: (Any)   There are n people taking dancing lessons. Every person is characterize…
B. Infinite Maze time limit per test  2 seconds memory limit per test  256 megabytes input standard input output  standard output We've got a rectangular n × m-cell maze. Each cell is either passable, or is a wall (impassable). A little boy found the…
Double Profiles Time Limit: 3000ms Memory Limit: 262144KB This problem will be judged on CodeForces. Original ID: 154C64-bit integer IO format: %I64d      Java class name: (Any)   You have been offered a job in a company developing a large social net…
An interesting mobile game Time Limit: 1000ms Memory Limit: 32768KB This problem will be judged on HDU. Original ID: 329564-bit integer IO format: %I64d      Java class name: Main   XQ,one of the three Sailormoon girls,is usually playing mobile games…
Colliders Time Limit: 2000ms Memory Limit: 262144KB This problem will be judged on CodeForces. Original ID: 155D64-bit integer IO format: %I64d      Java class name: (Any)   By 2312 there were n Large Hadron Colliders in the inhabited part of the uni…
C - Design the city Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Description Cerror is the mayor of city HangZhou. As you may know, the traffic system of this city is so terrible, that there are traffic jams everywhere.…
E - Palindromic Numbers Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Description A palindromic number or numeral palindrome is a 'symmetrical' number like 16461 that remains the same when its digits are reversed. In this…
D - Round Numbers Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Description The cows, as you know, have no fingers or thumbs and thus are unable to play Scissors, Paper, Stone' (also known as 'Rock, Paper, Scissors', 'R…
Post Office Time Limit: 1000ms Memory Limit: 10000KB This problem will be judged on PKU. Original ID: 116064-bit integer IO format: %lld      Java class name: Main     There is a straight highway with villages alongside the highway. The highway is re…
Subsequence Time Limit: 1000ms Memory Limit: 32768KB This problem will be judged on HDU. Original ID: 353064-bit integer IO format: %I64d      Java class name: Main     There is a sequence of integers. Your task is to find the longest subsequence tha…
To Add or Not to Add Time Limit: 2000ms Memory Limit: 262144KB This problem will be judged on CodeForces. Original ID: 231C64-bit integer IO format: %I64d      Java class name: (Any)   A piece of paper contains an array of n integers a1, a2, ..., an.…
Burning Bridges Time Limit: 5000ms Memory Limit: 32768KB This problem will be judged on ZJU. Original ID: 258864-bit integer IO format: %lld      Java class name: Main   Ferry Kingdom is a nice little country located on N islands that are connected b…
Opening Portals Time Limit: 2000ms Memory Limit: 262144KB This problem will be judged on CodeForces. Original ID: 196E64-bit integer IO format: %I64d      Java class name: (Any)     Pavel plays a famous computer game. A player is responsible for a wh…
Checkposts Time Limit: 2000ms Memory Limit: 262144KB This problem will be judged on CodeForces. Original ID: 427C64-bit integer IO format: %I64d      Java class name: (Any)     Your city has n junctions. There are m one-way roads between the junction…
Find Metal Mineral Time Limit: 1000ms Memory Limit: 65768KB This problem will be judged on HDU. Original ID: 400364-bit integer IO format: %I64d      Java class name: Main     Humans have discovered a kind of new metal mineral on Mars which are distr…
Water Tree Time Limit: 4000ms Memory Limit: 262144KB This problem will be judged on CodeForces. Original ID: 343D64-bit integer IO format: %I64d      Java class name: (Any)   Mad scientist Mike has constructed a rooted tree, which consists of n verti…
Number Busters Time Limit: 1000ms Memory Limit: 262144KB This problem will be judged on CodeForces. Original ID: 382B64-bit integer IO format: %I64d      Java class name: (Any)   Arthur and Alexander are number busters. Today they've got a competitio…
这里给出来一个后缀自动机的题解. 考虑对 $s$ 的正串和反串分别建后缀自动机. 对于正串的每个节点维护 $endpos$ 的最小值. 对于反串的每个节点维护 $endpos$ 的最大值. 这两个东西通过一个简单的基数排序就可以实现. 将 $p$ 的正串在正串的 SAM 上去匹配,一直匹配到匹配不了为止,并记录 $p[i]$ 在正串中自动机节点上 $endpos$ 的最小值 $a[i]$. 对 $p$ 的反串也进行相同的处理,记录 $endpos$ 的最大值 $b[i]$. 正串中的 $endp…
1.For the most part, coming up with appropriate definitions for your classes (and class templates) and appropriate declarations for your functions (and function templates) is the lion's share of the battle. Once you've got those right, the correspond…
B. Power Strings Time Limit: 3000ms Memory Limit: 65536KB 64-bit integer IO format: %lld      Java class name: Main   Given two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b =…
3.6. StringsConceptually, Java strings are sequences of Unicode characters(Java的字符串是一个Unicode序列). For example, the string "Java\u2122" consists of the five Unicode characters J, a, v, a, and ?. Java does not have a built-in string type(Java没有内置的…
  I know many people are bored of the string splitting problem, but it still seems to come up almost daily on forum and Q & A sites like StackOverflow. This is the problem where people want to pass in a string like this: EXEC dbo.UpdateProfile @UserI…
Problem: Design an algorithm to encode a list of strings to a string. The encoded string is then sent over the network and is decoded back to the original list of strings. Machine 1 (sender) has the function: string encode(vector<string> strs) { //…
Working with Strings By Steven Feuerstein  Part 3 in a series of articles on understanding and using PL/SQL Every application needs data. That seems rather obvious, doesn’t it? An application is almost always built on top of database tables. Those ta…