题目链接: http://codeforces.com/problemset/problem/522/D D. Closest Equals time limit per test3 secondsmemory limit per test256 megabytes 问题描述 You are given sequence a1, a2, ..., an and m queries lj, rj (1 ≤ lj ≤ rj ≤ n). For each query you need to print…
D. Closest Equals Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://www.lydsy.com/JudgeOnline/problem.php?id=3224 Description You are given sequence a1, a2, ..., an and m queries lj, rj (1 ≤ lj ≤ rj ≤ n). For each query you need to print the minimu…
B. Photo to Remember Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/522/problem/B Description One day n friends met at a party, they hadn't seen each other for a long time and so they decided to make a group photo together…
传送门 A. Reposts time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output One day Polycarp published a funny picture in a social network making a poll about the color of his handle. Many of his friend…
题目地址:http://blog.csdn.net/shiyuankongbu/article/details/10004443 /* 题意:在i前面找回文子串,在i后面找回文子串相互配对,问有几对 DP:很巧妙的从i出发向两头扩展判断是否相同来找回文串 dpr[i] 代表记录从0到i间的回文子串的个数,dpl[i] 代表记录i之后的回文子串个数 两两相乘就行了 详细解释:http://blog.csdn.net/shiyuankongbu/article/details/10004443 */…
C. Cd and pwd commands Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/problem/158/C Description Vasya is writing an operating system shell, and it should have commands for working with directories. To begin with, he dec…
C. String Manipulation 1.0 Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 codeforces.com/problemset/problem/91/B Description One popular website developed an unusual username editing procedure. One can change the username only by deleting some characte…
Cd and pwd commands time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Vasya is writing an operating system shell, and it should have commands for working with directories. To begin with, he…
今天在codeforces上面做到一道题:http://codeforces.com/contest/638/problem/B 题目大意是:给定n个字符串,找到最短的字符串S使得n个字符串都是这个字符串S的子串. 题目里有一个限制条件是每个字母都最多出现一次,所以可以用下面的方法来解决: http://codeforces.com/contest/638/submission/16900955 然后我想到如果问题没有“每个字母最多只出现一次”这个限制的话应该怎么解决. 暂时还在想………
D. Three-dimensional Turtle Super Computer 题目连接: http://www.codeforces.com/contest/638/problem/D Description A super computer has been built in the Turtle Academy of Sciences. The computer consists of n·m·k CPUs. The architecture was the paralellepip…
C. Road Improvement 题目连接: http://www.codeforces.com/contest/638/problem/C Description In Berland there are n cities and n - 1 bidirectional roads. Each road connects some pair of cities, from any city you can get to any other one using only the given…
B. Making Genome in Berland 题目连接: http://www.codeforces.com/contest/638/problem/B Description Berland scientists face a very important task - given the parts of short DNA fragments, restore the dinosaur DNA! The genome of a berland dinosaur has notin…
A. Home Numbers 题目连接: http://www.codeforces.com/contest/638/problem/A Description The main street of Berland is a straight line with n houses built along it (n is an even number). The houses are located at both sides of the street. The houses with od…
D. Running with Obstacles 题目连接: http://www.codeforces.com/contest/637/problem/D Description A sportsman starts from point xstart = 0 and runs to point with coordinate xfinish = m (on a straight line). Also, the sportsman can jump - to jump, he should…
C. Promocodes with Mistakes 题目连接: http://www.codeforces.com/contest/637/problem/C Description During a New Year special offer the "Sudislavl Bars" offered n promo codes. Each promo code consists of exactly six digits and gives right to one free…
B. Chat Order 题目连接: http://www.codeforces.com/contest/637/problem/B Description Polycarp is a big lover of killing time in social networks. A page with a chatlist in his favourite network is made so that when a message is sent to some friend, his fri…
A. Voting for Photos 题目连接: http://www.codeforces.com/contest/637/problem/A Description After celebrating the midcourse the students of one of the faculties of the Berland State University decided to conduct a vote for the best photo. They published t…
A. Voting for Photos time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output After celebrating the midcourse the students of one of the faculties of the Berland State University decided to conduct…
B. Chat Order time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Polycarp is a big lover of killing time in social networks. A page with a chatlist in his favourite network is made so that wh…
题目链接:http://codeforces.com/contest/158/problem/E E. Phone Talks time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Cool J has recently become a businessman Mr. Jackson, and he has to make a l…
VK Cup 2015 - Round 1 (unofficial online mirror, Div. 1 only)E. The Art of Dealing with ATM Time Limit: 2 Sec  Memory Limit: 256 MBSubmit: xxx  Solved: 2xx 题目连接 http://codeforces.com/contest/529/problem/E Description ATMs of a well-known bank of a sm…
Facebook Hacker Cup 2014 Qualification Round比赛Square Detector题的解题报告.单击这里打开题目链接(国内访问需要那个,你懂的). 原题如下: Square Detector Problem Description You want to write an image detection system that is able to recognize different geometric shapes. In the first ver…
2014 Qualification Round Solutions 2013年11月25日下午 1:34 ...最简单的一题又有bug...自以为是真是很厉害! 1. Square Detector (20 Points) When facing a problem in a programming contest there are three main things to consider when planning your solution. In order of importanc…
解题关键:kdtree模板题,距离某点最近的m个点. #include<cstdio> #include<cstring> #include<algorithm> #include<cstdlib> #include<iostream> #include<cmath> #include<queue> #define sq(x) (x)*(x) using namespace std; typedef long long l…
传送门 DZY Loves Topological Sorting Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 221    Accepted Submission(s): 52 Problem Description A topological sort or topological ordering of a directed…
E. Editor The development of a text editor is a hard problem. You need to implement an extra module for brackets coloring in text. Your editor consists of a line with infinite length and cursor, which points to the current character. Please note that…
题目链接:http://codeforces.com/contest/522/problem/D 题目大意:  给你一个长度为n的序列,然后有m次查询,每次查询输入一个区间[li,lj],对于每一个查询,输出在这个区间内的两个相等的数的最短距离,如果没有相等的则输出-1. 线段树+扫描线,线段树维护的值是区间的最小值,从后往前扫,然后每次要做的事有两个: 1.判断当前这个位置 i 的数刚刚是不是出现过,假设刚刚出现的位置是 l ,如果出现过,则在线段树中把l这个位置的值更新为 l - i,同时更…
E. Correcting Mistakes Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/problem/533/E Description Analyzing the mistakes people make while typing search queries is a complex and an interesting work. As there is no guarant…
题意: n * m的棋盘, k个位置有"rook"(车),q次询问,问是否询问的方块内是否每一行都有一个车或者每一列都有一个车? 满足一个即可 先考虑第一种情况, 第二种类似,swap一下就可以了. #include <bits/stdc++.h> using namespace std; ; inline int GetIdx(int l, int r){ return l + r | l != r; } ]; void update(int l, int r, int…
题目链接: http://codeforces.com/problemset/problem/533/B B. Work Group time limit per test2 secondsmemory limit per test256 megabytes 问题描述 One Big Software Company has n employees numbered from 1 to n. The director is assigned number 1. Every employee of…