Content 森林里面有很多声响,你想知道有哪些声响是由狐狸发出来的. 已知你搜集到了 \(n\) 个声响,并且还知道某些其他动物能够发出的声响,已知如果没有哪一个声响是由其他任何一种动物发出来的话,那这个声响绝对是由狐狸发出来的.现在,给定你这 \(n\) 个声响,以及某些其他动物能够发出的声响,请你求出狐狸发出的声响. 其他动物的声响和名字都仅由一个字符串组成. 数据范围:\(t\) 组询问,\(n\leqslant 100\),每个字符串的长度不超过 \(100\) 个字符且仅由小写字母…
可以用网络流解决这个题. 注意到\(a_i \geqslant 2\),所以当相邻数字要和为质数时,这两个数要一个为奇数,一个为偶数. 所以就先将所有数按奇偶分为两列,其就构成了一个二分图,二分图中和为质数的两个数间连容量为\(1\)的边,表示只能匹配一次. 因为是圆桌,所以一个数要恰好匹配两个数,所以每个点在和源汇点连边时,容量要为\(2\),同时这也保证了每个圆桌中至少有\(3\)个狐狸. 无解的情况就是二分图两个部分大小不是都为\(\frac{n}{2}\)或最大流的结果不为\(n\).…
B. Fox Dividing Cheese time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Two little greedy bears have found two pieces of cheese in the forest of weight a and b grams, correspondingly. The be…
D. Fox And Jumping 题目连接: http://codeforces.com/contest/510/problem/D Description Fox Ciel is playing a game. In this game there is an infinite long tape with cells indexed by integers (positive, negative and zero). At the beginning she is standing at…
C. Fox And Names 题目连接: http://codeforces.com/contest/510/problem/C Description Fox Ciel is going to publish a paper on FOCS (Foxes Operated Computer Systems, pronounce: "Fox"). She heard a rumor: the authors list on the paper is always sorted in…
B. Fox And Two Dots 题目连接: http://codeforces.com/contest/510/problem/B Description Fox Ciel is playing a mobile puzzle game called "Two Dots". The basic levels are played on a board of size n × m cells, like this: Each cell contains a dot that ha…
A. Fox And Snake 题目连接: http://codeforces.com/contest/510/problem/A Description Fox Ciel starts to learn programming. The first task is drawing a fox! However, that turns out to be too hard for a beginner, so she decides to draw a snake instead. A sna…
4052: [Cerc2013]Magical GCD Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 148  Solved: 70[Submit][Status][Discuss] Description 给出一个长度在 100 000 以内的正整数序列,大小不超过 10^12.  求一个连续子序列,使得在所有的连续子序列中,它们的GCD值乘以它们的长度最大.   Input   Output   Sample Input 1 5 30 60…
C. Fox and Card Game 题目连接: http://codeforces.com/contest/388/problem/C Description Fox Ciel is playing a card game with her friend Fox Jiro. There are n piles of cards on the table. And there is a positive integer on each card. The players take turns…
B. Fox and Minimal path 题目连接: http://codeforces.com/contest/388/problem/B Description Fox Ciel wants to write a task for a programming contest. The task is: "You are given a simple undirected graph with n vertexes. Each its edge has unit length. You…