题目链接:http://codeforces.com/contest/781/problem/B 去tmd 2-SAT 直接贪心就可以过去了,优先选择第二种情况. 然而....可以被叉掉(数据水了) ABC DDD ABD DOG #include<iostream> #include<cstdio> #include<algorithm> #include<vector> #include<cstdlib> #include<cmath&…
地址:http://codeforces.com/contest/782/problem/D 题目: D. Innokenty and a Football League time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Innokenty is a president of a new football league in B…
D. Innokenty and a Football League time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Innokenty is a president of a new football league in Byteland. The first task he should do is to assign s…
[题目链接]:http://codeforces.com/contest/782 [题意] 每个队名有两种选择, 然后第一个选择队名相同的那些队只能选第二种; 让你安排队名 [题解] 首先全都选成第一种队名; 然后第一种队名相同的队,它们只能全都变成选第二种队名的了; 这个时候如果第一种队名相同的那些队里面,变成第二种队名后有重复的,直接输出无解; 这个时候先不管第一种队名 之后再处理第一种队名; 看看第一种队名有没有和第二种队名重的; 如果有重的话就让他变到第二种队名; 以此法贪心就好 [完整…
先反复地扫(不超过n次),把所有可以确定唯一取法的给确定下来. 然后对于剩下的不能确定的,跑2-SAT.输出可行解时,对于a和¬a,如果a所在的强连通分量序号在¬a之前,则取a,否则不取a.如果a和¬a在同一个强连通分量,则无解. #include<cstdio> #include<iostream> #include<algorithm> #include<string> #include<vector> #include<cstring…
把每一次输入的一组数字存下来,然后把每个数字出现的组数存下来 然后找只出现过一次的数字a,那么这个数字a不是开头就是结尾,默认为开头(是哪个都无所谓),然后去找和它出现在同一组的两个数字b和c,而b和c同时出现的只有两组,除了已经知道的,就是需要去查找的,然后循环,同时存在的组数,找到两个数字a和b同时出现的组而且不是第一组,找到之后的组的第三个数字,就是要接在后面的数字,然后循环这个操作 #include <bits/stdc++.h> using namespace std; ][];//…
Codeforces Round #403 (Div. 2, based on Technocup 2017 Finals) 说一点东西: 昨天晚上$9:05$开始太不好了,我在学校学校$9:40$放学我呆到十点然后还要跑回家耽误时间....要不然$D$题就写完了 周末一些成绩好的同学单独在艺术楼上课然后晚上下第一节晚自习和他们在回廊里玩开灯之后再关上一片漆黑真好玩 A.Andryusha and Socks 日常煞笔提.....我竟然$WA$了一次忘了$n<<1$ #include <…
Div1单场我从来就没上过分,这场又剧毒,半天才打出B,C挂了好几次最后还FST了,回紫了. AC:AB Rank:340 Rating:2204-71->2133 Div2.B.The Meeting Place Cannot Be Changed 题目大意:n个人,第i个人位于xi,速度为vi,找到一个点使得所有人到这个点的耗时最小,输出耗时.(n<=60000) 思路:二分答案,知道耗时后可以求出每个人能到达的区间,如果所有区间有交则合法,复杂度O(nlog). #include<…
唉,昨天晚上迷迷糊糊地去打cf,结果fst两题,掉回蓝了... A.Andryusha and Colored Balloons 题意:给定一棵树,任意两个距离小等于二的点不能染相同的颜色,求最小颜色数和染色方案. n<=2*10^5 题解:求一个度数最大的点,度数+1即是颜色数,然后暴力染色. #include<iostream> #include<cstdio> #include<algorithm> #include<queue> #includ…
A. Andryusha and Socks time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Andryusha is an orderly boy and likes to keep things in their place. Today he faced a problem to put his socks in the…