[ARC062F]Painting Graphs with AtCoDeer】的更多相关文章

题意:一个无向图,用$k$种不同的颜色给每条边染色,问能染出多少种不同的图,如果两张图能通过循环移位环边使得颜色相同,那么这两张图被认为是相同的 数学太差伤不起啊...补了一下Burnside定理的证明,这里写一些类似笔记的东西... 置换$\left(\begin{matrix}1\cdots n\\i_1\cdots i_n\end{matrix}\right)$有合成运算$\circ$,满足结合律,有单位元$\iota$,存在唯一逆元满足$f\circ f^{-1}=\iota$,所有$n…
[Arc062] Painting Graphs with AtCoDeer Description 给定一张N点M边的无向图,每条边要染一个编号在1到K的颜色.你可以对一张染色了的图进行若干次操作,每次操作形如,在图中选择一个简单环(即不经过相同点的环),并且将其颜色逆时针旋转一个单位.形式的说,假设你选择的环上的边按顺序依次是e1, e2, ... ,ek,那么经过一次操作后ei mod n+1的颜色会变成操作前ei的颜色.两种染色方案被认为是本质相同的,当且仅当其中一种染色后 的图经过若干…
LINK:Painting Graphs with AtCoDeer 看英文题面果然有点吃不消 一些细节会被忽略掉. 问每条边都要被染色 且一个环上边的颜色可以旋转. 用c种颜色有多少本质不同的方法. 注意这里的环指简单环 即不能经过一个节点两次. 考虑环套环的情况 手玩可以发现 可以将这种情况出现的所有边按顺序放置. 那么只和颜色出现的次数有关 隔板法做即可. 一个环 容易发现可以使用\(burnside\)引理. 割边 也很容易. 难点是求简单环. 不能求割边 因为边双不一定是简单环. 但是…
题解 考虑一个点双(因为是简单环),如果没有环(两点一线),那么乘上K 如果有一个环,那么用polya定理,每个置换圈有gcd(i,n)个循环节 如果有两个及以上的环,任何一种置换都合法,那么只和每个颜色用了多少个有关,用插板法算组合数就是\(\binom{n + k - 1}{k - 1}\) 代码 #include <iostream> #include <cstdio> #include <vector> #include <algorithm> #i…
Description 给定一张N点M边的无向图,每条边要染一个编号在1到K的颜色. 你可以对一张染色了的图进行若干次操作,每次操作形如,在图中选择一个简单环(即不经过相同点的环),并且将其颜色逆时针旋转一个单位. 形式的说,假设你选择的环上的边按顺序依次是e1, e2, ... ,ek,那么经过一次操作后ei mod n+1的颜色会变成操作前ei的颜色. 两种染色方案被认为是本质相同的,当且仅当其中一种染色后的图经过若干次操作后可以变成另一种染色后的图. 问有多少本质不同的染色方案,输出对10…
题目传送门 https://atcoder.jp/contests/arc062/tasks/arc062_d 题解 首先对整张图做 Tarjan 点双. 对于一个点双,如果是由一条边构成的,那么很显然就是 \(K\) 种方案. 如果是由一个单环构成,可以直接使用 Burnside 引理,假设这个环的长度为 \(l\),则这个单环的贡献就是 \(\frac{\sum \limits_{i=0}^{l-1} k^{\gcd(i, l)}}l\). 否则,这个点双就是一个复合环.经过一些手动模拟的尝…
题目分析: 如果一个双连通分量是简单环,那么用polya原理计数循环移位即可. 如果一个双连通分量不是简单环,那么它必然可以两两互换,不信你可以证明一下相邻的可以互换. 如果一条边是桥,那么直接乘以k就行了. 代码: #include<bits/stdc++.h> using namespace std; ; ; int n,m,k; vector <int> g[maxn]; int fa[maxn],arr[maxn],dfn[maxn],bccnum,low[maxn],cl…
似乎好久都没写博客了....赶快来补一篇 题意 给你一个 \(n\) 个点 , 没有重边和自环的图 . 有 \(m\) 条边 , 每条边可以染 \(1 \to k\) 中的一种颜色 . 对于任意一个简单环 , 可以将它的边的颜色进行旋转任意位 . 询问本质不同的染色方案数个数 . 数据范围 \(1\le n \le 50, 1 \le m \le 100,1 \le k \le 100\\\) 题解 将边 (或者说是很多条边) 分为 \(3\) 种类型 : 不属于任何一个简单环 , 它的贡献为…
传送门 一道思维题. 如果没有环那么对答案有k的贡献. 如果恰为一个环,可以用polya求贡献. 如果是一个有多个环重叠的双联通的话,直接转化为组合数问题(可以证明只要每种颜色被选取的次数相同一定可以在进行若干次交换之后变成一样的),相当于选一个值域在[1,k][1,k][1,k]中的单调不下降子序列的个数. 这个跟bzoj4403求法是相同的. 对于序列中的每一个元素的值加上它自己的下标就转化成了单调上升子序列的个数,有(edgecnt+k−1k−1)\binom {edge_{cnt}+k-…
求出点双后缩点,对于点双之间,显然不存在简单环,即每一个简单环一定在一个点双内部,换言之即每一个点双可以独立的考虑,然后将结果相乘 (对于点双之间的边任意染色,即若有$s$条边,还会有$k^{s}$的贡献) 对点双分类讨论(假设其有$n$个节点,$m$条边): 1.$n=2$且$m=1$(也就是两点一边),贡献为$k$ 2.$n=m$(一个环),根据polya定理,贡献即$\frac{\sum_{i=0}^{n-1}k^{\gcd(n,i)}}{n}$ 3.$n<m$,则任意两边的颜色都可以单独…
私のZJOI Day2 2017-3-22 08:00:07 AtCoder试题选讲 SYC(Sun Yican) from Shaoxing No.1 High School 2017-3-22 08:00:07 AtCoder简介自己看. 1.寿司 有一个长为N数列A,初始全为0. 有Q次操作,每次操作两个参数X,Y 在A[1],A[2]-A[X]中找出最小的数,如果有多个找小标最小的,设找到了u A[u] = A[u] + 1 重复这个过程Y次 Solution: A[i] >= A[i…
Choosing Points 数学 Integers on a Tree 构造 Leftmost Ball 计数dp+组合数学 Painting Graphs with AtCoDeer tarjan+polya Building Cubes with AtCoDeer 枚举 AtCoDeer and Election Report 贪心 Snuke's Coloring 思维题 Snuke's Coloring 2 线段树+单调栈 Make Them Even 贪心 1D Reversi 模…
一句话题解 因为上篇AGC的写的有点长……估计这篇也短不了所以放个一句话题解方便查阅啥的吧QwQ 具体的题意代码题解还是往下翻…… ARC 058 D:简单容斥计数. E:用二进制表示放的数字,然后状压$DP$. F:$biset$优化$DP$预处理,乱搞贪心. ARC 059 D:傻题,存在长的合法子串就一定会存在短的. E:前缀和优化$DP$. F:每个长度为$len$的串出现的概率是相同的,求到长度为$len$的方案数然后除$2^{len}$. ARC 060 D:对$b$分大于根号和小于…
ARC062 C - AtCoDeerくんと選挙速報 / AtCoDeer and Election Report 每次看看比率至少变成多少倍能大于当前的数 然后就把两个人的票都改成那个数 #include <bits/stdc++.h> #define fi first #define se second #define pii pair<int,int> #define mp make_pair #define pb push_back #define space putcha…
Time limit : 2sec / Memory limit : 256MB Score : 700 points Problem Statement Squid loves painting vertices in graphs. There is a simple undirected graph consisting of N vertices numbered 1 through N, and M edges. Initially, all the vertices are pain…
On mac os, programs may need Instruments to tuning, and when you face too many probe messages, you'll need some Flame Graphs. Here I introduce Brendan Gregg and his blog: http://www.brendangregg.com/FlameGraphs/cpuflamegraphs.html and he mestioned on…
Codeforces Round #256 (Div. 2) C C. Painting Fence time limit per test 1 second memory limit per test 512 megabytes input standard input output standard output Bizon the Champion isn't just attentive, he also is very hardworking. Bizon the Champion d…
Chrome Canary(Chrome “金丝雀版本”)目前已经支持Continuous painting mode,用于分析页面性能.这篇文章将会介绍怎么才能页面在绘制过程中找到问题和怎么利用这个新的工具来解决页面性能上的瓶颈. PS:最新版本的Chrome已经支持该功能查看页面的渲染时间我们采用Things We Left On The Moon by Dan Cederholm的页面来作为我们的例子页面.打开Chrome的Web Inspector(即按F12),选择Timeline页卡…
Vasya works as a watchman in the gallery. Unfortunately, one of the most expensive paintings was stolen while he was on duty. He doesn't want to be fired, so he has to quickly restore the painting. He remembers some facts about it. The painting is a…
https://www.threadingbuildingblocks.org/docs/help/index.htm Parallelizing Data Flow and Dependency Graphs In addition to loop parallelism, the Intel® Threading Building Blocks (Intel® TBB) library also supports graph parallelism. It's possible to cre…
题目链接: Wall Painting Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2681    Accepted Submission(s): 857 Problem Description Ms.Fang loves painting very much. She paints GFW(Great Funny Wall) ev…
Problem C. Painting CottagesTime Limit: 2 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100342/attachments Description The new cottage settlement is organized near the capital of Flatland. The construction company that is building the settl…
https://en.wikipedia.org/wiki/Eigenvalues_and_eigenvectors#Graphs A               {\displaystyle A}   ,它的特征向量(eigenvector,也译固有向量或本征向量)                     v               {\displaystyle v}   经过这个线性变换[1]之后,得到的新向量仍然与原来的                     v          …
There are a row of houses, each house can be painted with three colors red, blue and green. The cost of painting each house with a certain color is different. You have to paint all the houses such that no two adjacent houses have the same color. You…
Problem Description Josh Lyman is a gifted painter. One of his great works is a glass painting. He creates some well-designed lines on one side of a thick and polygonal glass, and renders it by some special dyes. The most fantastic thing is that it c…
Wall Painting Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1026    Accepted Submission(s): 280 Problem Description Ms.Fang loves painting very much. She paints GFW(Great Funny Wall) every da…
Permutation Graphs Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit Status Practice UVALive 6508 #include<stdio.h> #include<string.h> ],a[],b[],c[],b1[]; long long num; void merg_sort(int a[],int l,int r) { int…
Cube painting Problem Description: We have a machine for painting cubes. It is supplied with three different colors: blue, red and green. Each face of the cube gets one of these colors. The cube's faces are numbered as in Figure 1. Figure 1. Since a…
Ball Painting 题目连接: http://codeforces.com/gym/100015/attachments Description There are 2N white balls on a table in two rows, making a nice 2-by-N rectangle. Jon has a big paint bucket full of black paint. (Don't ask why.) He wants to paint all the b…
题目链接: B. Restoring Painting time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasya works as a watchman in the gallery. Unfortunately, one of the most expensive paintings was stolen while he…