/* 题意:给出立方体的每个顶点的坐标(是由源坐标三个数某几个数被交换之后得到的!), 问是否可以还原出一个立方体的坐标,注意这一句话: The numbers in the i-th output line must be a permutation of the numbers in i-th input line! 思路: 我们只要对输入的每一行数据进行枚举每一个排列, 然后检查时候能构成立方体就好了! 检查立方体:找到最小的边长的长度 l, 统计边长为l, sqrt(2)*l, sqrt…
题目链接:http://codeforces.com/problemset/problem/323/A 题目意思:给定值 k ,需要输出 k 个 k 行 k 列的单位立方体各表示什么颜色(或者是黑色或者是白色).需要满足的条件是:如果是白色的单位立方体,那么它有且仅有2个白色的相邻单位立方体:如果是黑色的单位立方体,那么它有且仅有2个黑色的相邻单位立方体.要是给出的k不能构成满足这些条件的立方体,输出-1. 在纸上尝试过用次小的奇数 3 来模拟,发现无论如何都不能满足条件,于是大胆地猜测k是奇数…
Time limit 2000 ms Memory limit 262144 kB Polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev got hold of lots of wooden cubes somewhere. They started making cube towers by placing the cu…
我发现我构造题真的不会写, 想了好久才想出来.. 我们先把n = 2, 所有数字相等, 所有数字等于0的都特判掉. 找到一个b[ i ] > b[ i - 1 ]的位置把它移到最后一个位置, 并且使其a[ i ] = b[ i ]然后从后往前构造. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PLL pair<…
Cube Problem Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 299E Description Yaroslav, Andrey and Roman love playing cubes. Sometimes they get together and play cubes for hours and hours! T…
Polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev got hold of lots of wooden cubes somewhere. They started making cube towers by placing the cubes one on top of the other. They defined multiple t…
D - MUH and Cube Walls Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 471D Description Polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo o…
题目大意 一个含有 n 个顶点的无向图,顶点编号为 1~n.给出一个距离数组:d[i] 表示顶点 i 距离图中某个定点的最短距离.这个图有个限制:每个点的度不能超过 k 现在,请构造一个这样的无向图,要求不能有自环,重边,且满足距离数组和度数限制,输出图中的边:如果无解,输出 -1 数据规模:1 ≤ k < n ≤ 105,0 ≤ d[i] < n 做法分析 第一眼做法:SPFA 或者 BFS,想了想,还是乱搞 根据 d 数组直接构造这个图,因为最短路具有最优子结构,所以,d[i] 为 0…
F. Restore a Number Vasya decided to pass a very large integer n to Kate. First, he wrote that number as a string, then he appended to the right integer k — the number of digits in n. Magically, all the numbers were shuffled in arbitrary order whil…
E - Restore Given a matrix A of size N * N. The rows are numbered from 0 to N-1, the columns are numbered from 0 to N-1. In this matrix, the sums of each row, the sums of each column, and the sum of the two diagonals are equal. For example, a matrix…
D. MUH and Cube Walls 说实话,这题看懂题意后秒出思路,和顺波说了一下是KMP,后来过了一会确定了思路他开始写我中途接了个电话,回来kaungbin模板一板子上去直接A了. 题意:有两座城堡,每座城堡有一定的形状分别由高度区分.求第一座城堡中有多少个区间的形状和第二座城堡相似.连续一段区间高度可以任意变,但他们的相对位置是不变的. 思路:基于一段连续区间无论怎么变他们的相对位置不会变,所以分别将两个序列相邻的元素作差,一段区间的相对位置不会变,所以正好可以用差值去匹配.所以K…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Vasya decided to pass a very large integer n to Kate. First, he wrote that number as a string, then he appended to the right integer k - the num…
题目大意 Description 给你一个字符集合,你从其中找出一些字符串出来. 希望你找出来的这些字符串的最长公共前缀*字符串的总个数最大化. Input 第一行给出数字N.N在[2,1000000] 下面N行描述这些字符串,长度不超过20000 .保证输入文件不超过10MB Output 输出一行一个整数代表字符串的最长公共前缀*字符串的总个数的最大值. Sample Input 7 Jora de Sus Orhei Jora de Mijloc Joreni Jora de Jos Ja…
A. Taymyr is calling you time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output Comrade Dujikov is busy choosing artists for Timofey's birthday and is recieving calls from Taymyr from Ilia-alpinis…
地址:http://codeforces.com/contest/764/problem/B 题目: B. Timofey and cubes time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Young Timofey has a birthday today! He got kit of n cubes as a birthd…