[CF1097F]Alex and a TV Show(bitset) 题面 洛谷 CF 题解 首先模\(2\)意义下用\(bitset\)很明显了. 那么问题在于怎么处理那个\(gcd\)操作. 然后就莫比乌斯反演一下:\(f[n]=\sum\limits_{n|d}g[d],g[n]=\sum\limits_{n|d}\mu(\frac{d}{n})f[d]\),发现这样子搞完之后,如果要处理集合\(g\)的\(gcd\)操作,就是把\(g\)变成\(f\)之后再按位乘起来(二进制意义下的按…
题目描述: C. Producing Snow time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Alice likes snow a lot! Unfortunately, this year's winter is already over, and she can't expect to have any more of i…
Alice and Bob are playing a game with nn piles of stones. It is guaranteed that nn is an even number. The ii-th pile has aiai stones. Alice and Bob will play a game alternating turns with Alice going first. On a player's turn, they must choose exactl…
题目链接:http://codeforces.com/problemset/problem/711/C O(n^4)的复杂度,以为会超时的 思路:dp[i][j][k]表示第i棵数用颜色k涂完后beauty为j #include<bits/stdc++.h> using namespace std; typedef long long ll; const ll inf=1e15; int c[105]; int p[105][105]; ll dp[105][105][105]; int ma…
http://codeforces.com/problemset/problem/540/C Ice Cave Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 540C Description You play a computer game. Your character stands on some lev…
Good Bye 2018! 题目链接:https://codeforces.com/contest/1091 A. New Year and the Christmas Ornament 题意: 给出三堆数量分别为y,b,r的东西,现在要你从三堆中各选一堆,满足y'+1=b'且b'+1=r' (y',r',b'分别是指从中选取的个数). 现在问最多能拿出的个数为多少. 题解: 我是直接模拟的= =但是有更简单的方法. 让y+=2,b+=1,那么现在的最优解为min(y,b,r)*3-3.这个还…