Looksery Cup 2015】的更多相关文章

A. Face Detection Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/549/problem/A Description The developers of Looksery have to write an efficient algorithm that detects faces on a picture. Unfortunately, they are currently…
B. Looksery Party Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/549/problem/B Description The Looksery company, consisting of n staff members, is planning another big party. Every employee has his phone number and the pho…
下面是题解,做的不好.下一步的目标是rating涨到 1800,没打过几次cf A. Face Detection Author: Monyura One should iterate through each 2x2 square and check if it is possible to rearrange letters in such way they they form the word "face". It could be done i.e. by sorting al…
D. Haar Features Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/549/problem/D Description The first algorithm for detecting a face on the image working in realtime was developed by Paul Viola and Michael Jones in 2001. A p…
H. Degenerate Matrix Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/549/problem/H Description The determinant of a matrix 2 × 2 is defined as follows: A matrix is called degenerate if its determinant is equal to zero. The…
F - Yura and Developers 第一次知道单调栈搞出来的区间也能启发式合并... 你把它想想成一个树的形式, 可以发现确实可以启发式合并. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PII pair<int, int> #define PLI pair<LL, int> #defi…
The determinant of a matrix 2 × 2 is defined as follows: A matrix is called degenerate if its determinant is equal to zero. The norm ||A|| of a matrix A is defined as a maximum of absolute values of its elements. You are given a matrix . Consider any…
题目链接:http://codeforces.com/problemset/problem/549/C C. The Game Of Parity time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There are n cities in Westeros. The i-th city is inhabited by ai pe…
The first algorithm for detecting a face on the image working in realtime was developed by Paul Viola and Michael Jones in 2001. A part of the algorithm is a procedure that computes Haar features. As part of this task, we consider a simplified model…
#include <cstdio> #include <cstring> #include <algorithm> #include <string> #include <cmath> #include <iostream> using namespace std; bool fun(double l1,double r1,double l2,double r2){ return (l1 <= r2 && l1…
A题水 C题 博弈论,如果不是CF有WA具体哪个点错了和数据的话,AC要难许多. 如果D的操作数大于奇数个数直接Win 偶数个数大于等于n – k 时,S直接Win 偶数个数小于n – k时,若D操作数大于等于偶数个数,则输入拿掉所有偶数后最后剩下的奇数个数,剩奇数个则S,否则D 偶数个数小于n-k是,若D操作数小于偶数个数,则看S和D的操作数是否一致,是则D,否则S. D题水题 从右下角左上角更新就可以了 H题 数学带一点几何 把A,B矩阵的两行分别看成两个坐标,B是退化矩阵的充要条件是上下两…
There are n cities in Westeros. The i-th city is inhabited by ai people. Daenerys and Stannis play the following game: in one single move, a player chooses a certain town and burns it to the ground. Thus all its residents, sadly, die. Stannis starts…
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…
题目链接:http://codeforces.com/contest/522/problem/D 题目大意:  给你一个长度为n的序列,然后有m次查询,每次查询输入一个区间[li,lj],对于每一个查询,输出在这个区间内的两个相等的数的最短距离,如果没有相等的则输出-1. 线段树+扫描线,线段树维护的值是区间的最小值,从后往前扫,然后每次要做的事有两个: 1.判断当前这个位置 i 的数刚刚是不是出现过,假设刚刚出现的位置是 l ,如果出现过,则在线段树中把l这个位置的值更新为 l - i,同时更…
Name Quest time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys loo…
Mean Requests time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output In this problem you will have to deal with a real algorithm that is used in the VK social network. As in any other company tha…
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…
D. Restructuring Company Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/566/problem/D Description Even the most successful company can go through a crisis period when you have to make a hard decision — to restructure, disca…
题意: 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…
题意:给定A,B,K(A<=B)三个数,问在[A,B]范围内的数素数因子个数为K的个数. 题解:典型的筛选法求素数.首先建立一个保存素数因子个数的数组factorNum[],以及到n为止含有素数因子个数为k的二维数组sumNum[n][k]. factorNum能够由筛选法确定.初始化数组为0. 1. 从小到大遍历给定最大范围内的数,若遍历到数n时,factorNum[n]=0则说明这个数是素数(前面没有它的因子). 2. 然后通过添加n的倍数,来筛选出最大范围内含有素数因子n的数. sumNu…
原标题:https://www.facebook.com/hackercup/problems.php?pid=759650454070547&round=344496159068801 题意:给定一颗有根树,在树上下层的节点要给上层节点礼物,根节点的礼物则给慈善会,可是给礼物有个条件就是你不能送你的父节点已经送出的礼物.问满足要求的最少花费. 题解:这个题卡了一段时间,相似于染色问题,能够用树形动态规划求解.由于已知节点个数为N,则我们单个节点的最大花费不会超过log2(N) = 18. 1.…
题目链接: 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…
题目链接: 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…
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…
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…
E. Rooks and Rectangles Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/problem/524/E Description Polycarpus has a chessboard of size n × m, where k rooks are placed. Polycarpus hasn't yet invented the rules of the game…
这题做得比较复杂..应该有更好的做法 题目大意: 有一个括号序列,可以对其进行两种操作: ·        向里面加一个括号,可以在开头,在结尾,在两个括号之间加. ·        对当前括号序列进行循环移动,即把最后一个括号拿到开头来. 上述两种操作可以做任意次,要求添加最少的括号使得原序列变成一个合法括号序列.如果有多种可能,输出字典序最小的那一个."(" < ")". 题解: 首先计算左括号和右括号的数量,可以知道,不妨假设左括号的数量大于右括号 那么…
题目链接:http://codeforces.com/contest/533/problem/E E. Correcting Mistakes time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Analyzing the mistakes people make while typing search queries is a…
传送门 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://codeforces.com/problemset/problem/566/D [题意] 给你n个人; 一开始每个人都隶属于一个部门; 之后给你q个操作; 3种操作类型; 1.把x和y所在的部门的所有人都并在一个新的部门 2.把x..y这个区间范围里面的人所在的部门的所有人都并在一个部门; 3.查询x和y是否在同一个部门; [题解] 并查集; 这里把x..y并在一起; 相当于有y-x个合并操作 ①for (int i = x+1;i<=y;i++) merge(i-1…