time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Dasha logged into the system and began to solve problems. One of them is as follows: Given two sequences a and b of length n each you need to wr…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output On her way to programming school tiger Dasha faced her first test - a huge staircase! The steps were numbered from one to infinity. As we know,…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Running with barriers on the circle track is very popular in the country where Dasha lives, so no wonder that on her way to classes she saw the…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output After overcoming the stairs Dasha came to classes. She needed to write a password to begin her classes. The password is a string of length n whi…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output After overcoming the stairs Dasha came to classes. She needed to write a password to begin her classes. The password is a string of length n whi…
[题目链接]:http://codeforces.com/contest/761/problem/E [题意] 给你一棵树,让你在平面上选定n个坐标; 使得这棵树的连接关系以二维坐标的形式展现出来; [题解] dfs来搞; 显然如果某个点的度数大于4就无解. 初始坐标为(0,0)然后每一层的边的长度变为上一层长度的1/2 初始层的长度为2 30   这样可以保证每层节点都不会和上一层的相交; 因为2 i >2 1 +2 2 +...+2 i−1   又因为最多只有30个节点,所以这么做肯定是可以…
[链接] 我是链接,点我呀:) [题意] 定义两个函数 f和g f(i)表示a[1..i]中等于a[i]的数字的个数 g(i)表示a[i..n]中等于a[i]的数字的个数 让你求出来(i,j) 这里i<j 的二元组个数 且f(i)>g(j) [题解] 求出来两个数组g[N]和f[N]; (用map就行) 要算出(i< j)且f[i]>g[j]的个数 我们可以先把 g[1..n]全都加入到树状数组中. 然后顺序枚举i 遇到i就把g[i]从树状数组中删掉. 这样就只包括g[i+1..n…
题目链接:http://codeforces.com/contest/761/problem/D 题意:给出一个长度为n的a序列和p序列,求任意一个b序列使得c[i]=b[i]-a[i],使得c序列的大小顺序和p序列一样. p序列给出的的是1-n不重复的数.还有给出的l和r是b序列的大小范围 显然为了要使结果存在尽量使b取得最接近r,所以可以先按p排序一下,从大到小处理b,二分l,r的值使得每次的b尽量 大. #include <iostream> #include <cstring&g…
题目链接 Dasha and Very Difficult Problem 求出ci的取值范围,按ci排名从小到大贪心即可. 需要注意的是,当当前的ci不满足在这个取值范围内的时候,判为无解. #include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i(a); i <= (b); ++i) + ; int a[N], b[N], c[N], op[N]; int l, r, L, R, cnt; b…
[codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=2000),问满足[数列长度是k && 数列中每一个元素arr[i]在1~n之间 && 数列中元素可以重复]的数列有多少个?结果对10^9+7取余 解题思路:dp[i][j]表示长度是j,最后一位是i的种数 if(kk%i==0) dp[kk][j+1]+=dp[i][j] #inc…