题意:有\(n\)个点,\(m\)条边,只有当你的智力值大于这条边的\(w\)才能走,问在花费不超过\(k\)的情况下,从\(1\)走到\(n\)的所需的最小智力值. 题解:这题比赛为什么没想出来呢?赛后看题解发现可以二分答案然后跑最短路来check,网上的题解全都是SPFA啊,我还是喜欢写dijkstra qwq. 代码: struct misaka{ int out; int val; int wis; }e; int t; int n,m,k; vector<misaka> v[N];…
Problem Description    "Guanxi" is a very important word in Chinese. It kind of means "relationship" or "contact". Guanxi can be based on friendship, but also can be built on money. So Chinese often say "I don't have one…
今日份的训练题解,今天写出来的题没有昨天多,可能是因为有些事吧... Gym100814B 这个题就是老师改卷子,忘带标准答案了,但是他改了一部分卷子,并且确定自己改的卷子没出错,他想从改过的卷子里把标准答案推出来. 因为是选择题,答案就是A,B,C,D里的一个,如果A,B,C,都不对,那就是D对.如果不确定就是?,就是这样的题目. 一开始写的忘记判断如果三个选项都不对,那么剩下的就是答案这个了... 代码写的很丑,想不到简单的写法... 代码: #include<iostream> #inc…
A.Arcade Game(康拓展开) 题意: 给出一个每个数位都不同的数n,进行一场游戏.每次游戏将n个数的每个数位重组.如果重组后的数比原来的数大则继续游戏,否则算输.如果重组后的数是最大的数则算赢,问赢的概率. 题解: 用康拓展开求出n是第几大的数,然后递推后面的概率. #include <bits/stdc++.h> using namespace std; typedef long long ll; int t; ]; double ans; ] = {, , , , , , , ,…
这个题就是二进制,找两个数相应的二进制相对应的位置上数不同的最多的个数.异或写就可以. 一开始还想麻烦了,找出来最大的偶数和最大的奇数,最小的偶数和最小的奇数,但是这样想考虑的不全.因为范围比较小,直接遍历都比较一遍就可以. 代码: 1 #include<iostream> 2 #include<cstring> 3 #include<cstdio> 4 #include<algorithm> 5 using namespace std; 6 const i…
这个题真的是超级超级水啊,哈哈哈哈哈哈.不要被题面吓到,emnnn,就这样... 代码: 1 #include<iostream> 2 #include<cstring> 3 #include<cstdio> 4 #include<algorithm> 5 using namespace std; 6 int main(){ 7 int n,m; 8 int t; 9 scanf("%d",&t); 10 while(t--){…
今日份的训练题解,今天写出来的题没有昨天多,可能是因为有些事吧... 这个题就是老师改卷子,忘带标准答案了,但是他改了一部分卷子,并且确定自己改的卷子没出错,他想从改过的卷子里把标准答案推出来. 因为是选择题,答案就是A,B,C,D里的一个,如果A,B,C,都不对,那就是D对.如果不确定就是?,就是这样的题目. 一开始写的忘记判断如果三个选项都不对,那么剩下的就是答案这个了... 代码写的很丑,想不到简单的写法... 代码: #include<iostream> #include<cst…
ACM International Collegiate Programming Contest World Finals 2014 A - Baggage 题目描述:有\(2n\)个字符摆在编号为\(1\)~\(2n\)格子里,奇数位为\(B\),偶数位为\(A\),另外编号为\((-2n+1)\)~\(0\)的格子是空的,现在可以移动两个相邻的字符,移动到两个空的格子里,最终使得全部\(A\)在全部\(B\)的左边,而且字符都是连续的,但不必放回原位,输出最小步数的方案. solution…
ACM International Collegiate Programming Contest World Finals 2013 A - Self-Assembly 题目描述:给出\(n\)个正方形组件,正方形每条边有一个标签,标签可能是00,表示这条边不能与其它边相拼,也可能是一个字母加正号或负号,相同字母不同符号的边可以相拼.每个组件有无限个,问利用这些组件是否能拼出一个无限大的多边形. solution 拆点,每个正方形拆成\(4\)个点,每条边一个,然后每条边拆成两个点(出点和入点)…
ACM International Collegiate Programming Contest, Tishreen Collegiate Programming Contest (2018) Syria, Lattakia, Tishreen University, April, 30, 2018 Problem A. Can Shahhoud Solve it? Problem B. Defeat the Monsters Problem C. UCL Game Night Problem…
ACM International Collegiate Programming Contest, Tishreen Collegiate Programming Contest (2017)- K. Poor Ramzi -dp+记忆化搜索 [Problem Description] 给你一串\(01\)字符串,将其划分,使得划分后,分别求出每组\(01\)之和后是回文的,求划分的方案数, [Solution] 定义\(dp[l][r]\)表示,区间\([l,r]\)中满足条件的方案数是多少.…
IEEE/ACM International Conference on Advances in Social Network Analysis and Mining (ASONAM) 2014 Industry Track Call for Papers * Apologies if you received multiple copies of this CFP * Beijing China August 17-20, 2014Home Page: www.asonam2014.org F…
IEEE/ACM International Conference on Advances in Social Network Analysis and Mining (ASONAM) 2014 Industry Track Call for Papers Beijing China August 17-20, 2014Home Page: www.asonam2014.org Full paper/short paper/extended abstract submission deadlin…
2017 ACM - ICPC Asia Ho Chi Minh City Regional Contest A - Arranging Wine 题目描述:有\(R\)个红箱和\(W\)个白箱,将这些箱子分成若干堆,使得每一堆只有一种颜色,然后将这些堆排成一排,使得相邻的堆的颜色不一样,并且每堆红箱的个数不能超过\(d\),问有多少种方案. solution 不会. B - Barcode 题目描述:有一排\(n\)个球,现在要给这\(n\)个球涂成红色或蓝色,使得红色球的个数等于蓝色球的个数…
POJ 3660 Cow Contest / HUST 1037 Cow Contest / HRBUST 1018 Cow Contest(图论,传递闭包) Description N (1 ≤ N ≤ 100) cows, conveniently numbered 1..N, are participating in a programming contest. As we all know, some cows code better than others. Each cow has…
https://codeforces.com/gym/101810 A. Careful Thief time limit per test 2.5 s memory limit per test 256 MB input standard input output standard output There are consecutive buildings numbered from 1 to 109 each of which has an amount of money in it. T…
题目链接:https://codeforces.com/gym/101853 A: ✅ B: (二分图匹配) https://blog.csdn.net/qq_41997978/article/details/89165151(二分图匹配+基础数论+算术分解建图) C: (逆序对) 已过 D:✅ E:✅ https://blog.csdn.net/Link_Ray/article/details/89102023 (状压经典题) F:✅ G: 已过 https://blog.csdn.net/L…
bryce1010模板 http://codeforces.com/gym/101810 #include <bits/stdc++.h> using namespace std; #define ll long long const int MAXN=1010; int a[MAXN<<1]; int main() { int t; cin>>t; int n; while(t--) { cin>>n; for(int i=1;i<=2*n;i++)…
bryce1010模板 http://codeforces.com/gym/101810 #include<bits/stdc++.h> using namespace std; #define ll long long ll a[1000005]; int main() { int t,n,temp; ll ans,maxn,minl,x; scanf("%d",&t); while(t--) { scanf("%I64d",&n);…
bryce1010模板 http://codeforces.com/gym/101810 #include<bits/stdc++.h> using namespace std; #define ll long long const ll maxn = 1e5 + 5; const ll mod = 1e9+7; ll n; ll p[maxn]; ll vis[maxn]; int main() { ll t; scanf("%lld",&t); ll pre;…
bryce1010模板 http://codeforces.com/gym/101810 #include <bits/stdc++.h> using namespace std; #define ll long long int main() { int t; scanf("%d",&t); ll n,m; while(t--) { scanf("%lld%lld",&n,&m); ll cnt=0; if(m>n)swa…
bryce1010模板 http://codeforces.com/gym/101810 #include <bits/stdc++.h> using namespace std; #define ll long long ll lowbit(ll x) { return x&(-x); } int main() { ll t; cin>>t; ll x; while(t--) { cin>>x; ll res=1; while((x&1)==0) {…
bryce1010模板 http://codeforces.com/gym/101810 #include <bits/stdc++.h> using namespace std; #define ll long long int main() { int T; cin >> T; while (T--) { ll n, x; cin >> x >> n; if (n == 1) { cout << x << endl; contin…
bryce1010模板 http://codeforces.com/gym/101810/problem/A 大模拟,写崩了,代码借队友的...... 注意处理段与段的连接问题: #include<bits/stdc++.h> using namespace std; const int maxn=1e5+5; struct node{ long long l,r,val; node(){} node(long long ll,long long rr,long long vval) { l=…
题目链接:https://codeforces.com/gym/101856 D. Dream Team 题意:n个点,让你连边成为一棵树,边权为顶点的GCD(u,v).求所有边权和的最大值. 思路:将每个数进行因数分解,从大的因子开始求最大生成树. #include<bits/stdc++.h> using namespace std; ; vector<int> G[maxn]; int far[maxn]; int n; int find(int x) { if(far[x]…
题意:有\(n\)个点,\(n-1\)条边,每条边正向和反向有两个权值,且每条边最多只能走两次,有\(m\)次询问,问你从\(u\)走到\(v\)的最大权值是多少. 题解:可以先在纸上画一画,不难发现,除了从\(u\)走到\(v\)的路径上的反向权值我们取不到,其他所有边的正反权值均能取到,所以答案就是:\(sum-u->v路径的反向权值\),问题也就转换成了求\(v->u\)的权值,那么这里我们就可以用LCA来求了. 首先,令一个点为根节点,然后求出\(v\)到根节点的距离和根节点到\(u\…
题目链接:https://vjudge.net/contest/155219#overview. A题,用全排列来找出比当前这个数字字典序还大的排列有几个,然后前缀和dp即可.据说可以康拓展开来快速找出前面需要实现的要求. B题,水题. C题,感觉数据比较水.做法是dsu+lca,但是为了实现lca树的结构不被破坏,dsu::find()不能压缩路径.然后线性找lca没T也是有点神奇. D题,dfs即可. E题,dp[i][j][k],表示到了(i,j)并且已经吃了k个2,最多吃了几个3的状态.…
题目链接:http://codeforces.com/gym/101147 2017/8/27日训练赛,题目情况9/11,Rank 4/79. A. The game of Osho 题意:定义一个子游戏,B,N可以从N减掉B^k要求B^k小于等于N,当N变成0,该哪个人选,哪个人就输了,给出G个这样的游戏,问最后的输赢情况. 解法:组合游戏,SG打表发现规律,然后求Nim和判断即可. #include <bits/stdc++.h> using namespace std; typedef…
A.The game of Osho(sg函数+二项展开) 题意: 一共有G个子游戏,一个子游戏有Bi, Ni两个数字.两名玩家开始玩游戏,每名玩家从N中减去B的任意幂次的数,直到不能操作判定为输.问谁最终能赢. 题解: GYM - 101147 A.The game of Osho #include <bits/stdc++.h> using namespace std; int t; int g; int b, n; int ans; int main() { freopen("…
这套题似乎是省选前做的,一直没来写题解---补上补上>_< 链接:http://codeforces.com/gym/101147 一样先放上惨不忍睹的成绩好了--- Problem A 1Y(2h52min) Problem B DNF Problem C DNF Problem D 1Y(3min) Problem E 2Y(19min) Problem F DNF Problem G 6Y(2h40min) Problem H 1Y(36min) Problem I 2Y(4h55min…