COCI2014-2015CONTEST#7——POLICE】的更多相关文章

音乐赏析似乎是一件没有意义的工作,与电影相比音乐更加抽象,不同的人对同一首歌会有完全不同的解读. 但一首歌一旦成为经典,就有解读它的必要,因为它一定诉出了一个群体的某些情绪. Karma police, arrest this man He talks in math He buzzes like a fridge He's like a detuned radio Karma police, arrest this girl Her Hitler hairdo Is making me fee…
题目链接: http://codeforces.com/problemset/problem/208/C C. Police Station time limit per test:2 secondsmemory limit per test:256 megabytes 问题描述 The Berland road network consists of n cities and of m bidirectional roads. The cities are numbered from 1 to…
http://www.hsin.hr/coci/archive/2014_2015/contest7_tasks.pdf [题目描述] 有N个书架,每个书架可以容纳M本书.给出了若干本书,每本书有一个正整数的唯一编号,且编号不超过N*M. 给出了初始时各个书架里面的书的编号,即给出二维数组S[1..N][1..M].设S[i][j]=k,表示的意义是第i个书架的第j个格子放的那本书的编号是k.如果k等于0则说明该格子没有书,是空的.一个格子最多只能放一本书.再给出二维数组T[1..N][1..M…
96D - Police Stations 思路:bfs,从所有的警察局开始bfs,因为bfs的深度一样,而且题目给的树保证满足条件,所以不用考虑深度. 如果搜索到一个点a,他的下一个点b已经被搜索过了,而且a到b这条路没有被走过,那么这条路可以被砍掉. 不能用dfs,这样可能导致某些点搜索不到,反例读者自己找. 代码: #include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back…
地址:http://codeforces.com/contest/796/problem/D 题目: D. Police Stations time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Inzane finally found Zane with a lot of money to spare, so they togeth…
传送门 分析 看到这个题我们的第一反应自然是Tarjan缩点,在这之后我们可以发现实际只要在缩点之后所有出度或入度为0的点布置警察局就可以达到要求,我们用dpij表示考虑前i个出度或入度为0的点共布置了j个警察局,s[i]表示这个点原先由几个点构成,tot表示出度或入度为0的点的总数,所以不难得到转移方程 所以不难得到最终答案 注意此题需要使用高精度. 代码 #include<iostream> #include<cstdio> #include<cstring> #i…
Inzane finally found Zane with a lot of money to spare, so they together decided to establish a country of their own. Ruling a country is not an easy job. Thieves and terrorists are always ready to ruin the country's peace. To fight back, Zane and In…
On April 7, 2017, residents in Dallas, Texas, woke to the sound of emergency sirens blaring all over the city. No one could shut them off, and after repeated efforts to contain the situation, the city had to shut down the entire system. While the med…
Police Cities Time Limit: 10 Seconds      Memory Limit: 32768 KB Once upon the time there lived a king and he had a big kingdom. And there were n cities in his kingdom and some of them were connected by the roads. And the roads were all one-way becau…
[题解]Norma [COCI2014] [SP22343] 传送门:\(\text{Norma [COCI2014]}\) \(\text{[SP22343]}\) [题目描述] 给定一个整数 \(n\) 和一个长度为 \(n\) 的序列 \(a\),子序列是指原序列中一段连续的序列.子序列的价值定义为它们中的最小值乘以最大值再乘以该子序列长度 .现要计算所有子序列的价值之和,答案对 \(1e9\) 取模. [样例] 样例输入: 3 1 2 样例输出: 16 样例输入: 4 2 4 1 4 样…