CodeForces - 1017D The Wu】的更多相关文章

题意: 给你n m q,表示在这一组数据中所有的01串长度均为n,然后给你一个含有m个元素的multiset,之后有q次询问.每次询问会给你一个01串t和一个给定常数k,让你输出串t和multiset里面多少个元素的“Wu”值不超过k.对于“Wu”值的定义:如果两个01串s和t在位置i上满足s[i]==t[i],那么加上w[i],处理完s和t的所有n位之后的结果即为这两个01串的“Wu”值. n<12,k<100,m<5e5 思路: n很小,k也很小,所以串的状态最多2^12次,预处理出…
题面在这里! 比较显而易见的暴力,O(2^(2n) + 2^n * 100) 就可以直接做了 #include<bits/stdc++.h> #define ll long long using namespace std; const int N=4105; #define pb push_back inline int getint(){ int x=0; char ch=getchar(); for(;!isdigit(ch);ch=getchar()); for(;isdigit(ch…
D. The Wu time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Childan is making up a legendary story and trying to sell his forgery — a necklace with a strong sense of "Wu" to the Kasoura…
[链接] 我是链接,点我呀:) [题意] 给你n个字符串放在multiset中. 这些字符串都是长度为m的01串. 然后给你q个询问 s,k 问你set中存在多少个字符串t 使得∑(t[i]==s[i])*w[i]的值<=k [题解] 虽然询问很多. 但分类一下最多也只有2^12个01串类型. (01串可以和10进制数字一一对应) 我们可以先预处理一下答案.到时候直接输出. 2^12将近4500的样子 两重循环i,j 算出来01串i它和其他字符串j的特殊值为pair(i,j)的j的个数. 然后f…
链接:https://codeforces.com/contest/1099 A - Snowball - [模拟水题] 题意:有一个雪球从山顶滚落,山坡上有两块石头,每秒钟会一次发生三件事:1.雪球增重,数值为当前高度:2.如果当前高度有一块石头,则会撞到石头,损失跟石头同样重的重量:3.往下移动一米.此外,若雪球的重量如果变为负数,则自动变成零.雪球会在高度为零处停止滚动,问停止滚动时雪球重量. 题解:模拟水题. AC代码: #include<bits/stdc++.h> using na…
目录 Codeforces 1000 A.Codehorses T-shirts B.Light It Up C.Covered Points Count(差分) D.Yet Another Problem On a Subsequence(DP) E.We Need More Bosses(圆方树) \(Description\) \(Solution\) F.One Occurrence(线段树) \(Description\) \(Solution\) G.Two-Paths(树形DP)…
Codeforces Round #532 (Div. 2) 题目总链接:https://codeforces.com/contest/1100 A. Roman and Browser 题意: 给出由-1和1组成的n个数,现在任意选定一个起点,从起点开始向左向右k个k个地拿走.最后问abs(cnt(-1)-cnt(1))最大是多少. 题解: 由于n和k最多只有100,所以枚举起点直接暴力就好了. 代码如下: #include <bits/stdc++.h> using namespace s…
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题.. 今天,我们来扒一下cf的题面! PS:本代码不是我原创 1. 必要的分析 1.1 页面的获取 一般情况CF的每一个 contest 是这样的: 对应的URL是:http://codeforces.com/contest/xxx 还有一个Complete problemset页面,它是这样的:…
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the grid. Each of the ships consists of bconsecutive cells. No cell can be part of two ships, however, the shi…
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants to reach cinema. The film he has bought a ticket for starts in t minutes. There is a straight road of length s from the service to the cinema. Let's…