突然发现百度不到这题的单独题解(果然是因为这是水题么),那我就来写一个了~ 先把题给贴了. C. Petya and Catacombs time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output A very brave explorer Petya once decided to explore Paris catacombs. Sin…
题目出处:http://codeforces.com/problemset/problem/886/C 题目大意:很多墓穴之间有通道,探险家来回穿梭并记录日志 日志规则:第一次到该墓穴计时间t,0<=t<当前时间i:再次经过记录i #include<iostream> #include<set> using namespace std; //集合的运用 int main(){ set<int> all; int n,x; cin>>n; ;i&l…
C. Petya and Catacombstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputA very brave explorer Petya once decided to explore Paris catacombs. Since Petya is not really experienced, his exploration is…
C. Petya and Catacombs time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output A very brave explorer Petya once decided to explore Paris catacombs. Since Petya is not really experienced, his explor…
A very brave explorer Petya once decided to explore Paris catacombs. Since Petya is not really experienced, his exploration is just walking through the catacombs. Catacombs consist of several rooms and bidirectional passages between some pairs of the…
题目描述 A very brave explorer Petya once decided to explore Paris catacombs. Since Petya is not really experienced, his exploration is just walking through the catacombs. Catacombs consist of several rooms and bidirectional passages between some pairs o…
D. Numbers time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output One day Anna got the following task at school: to arrange several numbers in a circle so that any two neighboring numbers differs…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 看看时间戳为i的点有哪些. 每次优先用已经访问过的点. 如果不行就新创一个点. 注意新创点的时间戳也是i. [代码] #include <bits/stdc++.h> using namespace std; const int N = 2e5; int n; int now = 1, tot = 1; vector <int> have[N + 10]; int before[N + 10]; int main(…
wa一万次难受. #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using namespace std; #define max_n 100010 char a[max_n],b[max_n],c[max_n]; ]; int main() { ; memset(d,,sizeof(d)); scanf("%s",a); getchar();…
题意: 已知26个小写字母有各自的权值(正,负,或0) 现在给出一个字符串,长度<=1e5 问这个字符串有多少个子串满足: 开头的字母和结尾的字母一样 字符串除了开头和结尾的字母外,其余的字母的权值和为0 本来是一道水题,一看就知道大体的思路了,结果硬是搞了一个多小时 先是用set,发现超时了,改为用map 思路: 1.我们先预处理这个字符串的权值的前缀和 sum[i]表示从字符串的起点到i的权值和 2.我们要找到的子串,设以l开头和r结尾,则有 str[r] == str[l] 和 sum[r…