构造 #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> using namespace std; ][][]; int main() { a[][][]=; a[][][]=; a[][][]=; a[][][]=-; ; ; i<=; i++) { len=len*; ; r<=len/; r++) ; c<=len/; c++) a[i][r][…
C. Harmony Analysis 题目连接: http://www.codeforces.com/contest/610/problem/C Description The semester is already ending, so Danil made an effort and decided to visit a lesson on harmony analysis to know how does the professor look like, at least. Danil…
C. Harmony Analysis time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output The semester is already ending, so Danil made an effort and decided to visit a lesson on harmony analysis to know how do…
time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard output The semester is already ending, so Danil made an effort and decided to visit a lesson on harmony analysis to know how does the professor look li…
C. Harmony Analysis   The semester is already ending, so Danil made an effort and decided to visit a lesson on harmony analysis to know how does the professor look like, at least. Danil was very bored on this lesson until the teacher gave the group a…
[题目链接] http://codeforces.com/problemset/problem/610/C [题目大意] 构造出2^n个由1和-1组成的串使得其两两点积为0 [题解] 我们可以构造这样一个矩阵,右下角四分之一和其余三个分块相反, 不断扩展这个矩阵即可. [代码] #include <cstdio> #define rep(i,n) for(int i=1;i<=n;i++) using namespace std; const int N=1000; int k,p[N]…
题目链接:http://codeforces.com/contest/610/problem/C 解题思路: 将后一个矩阵拆分为四个前一状态矩阵,其中三个与前一状态相同,剩下一个直接取反就行.还有很多种取法,这种比较方便就是. 实现代码: #include<iostream> #include<string> #include<cmath> using namespace std; ][],b[][]; int main() { int n; cin>>n;…
Codeforces 题面传送门 & 洛谷题面传送门 一道不算困难的构造,花了一节英语课把它搞出来了,题解简单写写吧( 考虑从大往小加数,显然第三个条件可以被翻译为,每次加入一个元素,如果它所在的行/列存在元素,那么它必须为这一行/列所在的元素相邻,因此我们考虑这样构造,当我们加入一个数 \(v\) 时,分以下几种情况考虑: 如果 \(v\) 在原矩阵中既是行的最大值,也是列的最大值,那我们新开一行一列并将这个元素塞进去.即我们动态维护一个 \(R,C\) 表示目前有 \(R\) 行 \(C\)…
B. Looksery Party time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The Looksery company, consisting of n staff members, is planning another big party. Every employee has his phone number and…
输入n 1 <= n <= 100 有一个n * n * n 的立方体,由n ^ 3 个1 * 1 * 1 的单位立方体构成 要用white 和 black 2种颜色来染这n ^ 3个立方体,要求: 白色的立方体恰好有2个相邻的白色立方体 黑色的立方体恰好有2个相邻的黑色立方体 无解的时候输出-1,有解的时候输出一种染色方案 solution: n为奇数时,无解,输出 -1 n为偶数时,n = 2时的答案: bb    ww bb    ww n > 2时,以n=2为中心向外面扩展,进行…