A group of contest writers have written n problems and want to use k of them in an upcoming contest. Each problem has a difficulty level. A contest is valid if all of its k problems have different difficulty levels. Compute how many distinct valid co…
题目:https://vj.69fa.cn/12703be72f729288b4cced17e2501850?v=1552995458 dp这个题目网上说是dp+离散化这个题目要对这些数字先处理然后进行dp,这个处理值得学习一下,就是把数字范围为1~1e9,转化成一个顺序列表,这个顺序列表每一个不同的位置含有不同的难度,dp[i][j]代表前面i种选出j种的方案数. #include <cstdio> #include <iostream> #include <cstdlib…
比赛链接:Contest Setting C题 题意:$n$道题目,每道题目难度为$ai$,选择$k$道难度不同的题目,有多少种选择方案.$1<=k<=n<=1000,1<=ai<=10^9$ 题解:问题转化一下(map,离散化均可):m种难度,每种难度有bi道题目,每次从m种中选择k种,把对应的题目数量相乘,求总和. 列出$dp[i][j]$:表示前j个物品以j结尾选择i个的方案数:$sum[i][j]$:表示从1-j分别作为结尾选择i个的方案数总和. $dp[i][j]=…
题目链接:https://vjudge.net/contest/273260#problem/C 学习了一下别人的思路,首先去重,然后离散化. dp数组开二维,每一次更新,状态转移方程,dp[ i ][ j ] = (dp[ i-1] [ j ]+dp[ i-1] [ j -1 ]*(ans[ i ]))%mod; 第i种商品第j种(j<=k)的时候,等于第i-1个商品第j种的总方法数加上第i-1个的第j-1个乘以ans[i],ans数组记录的是这种商品当前有多少种. AC代码: #includ…
2018-2019 ACM-ICPC Pacific Northwest Regional Contest (Div. 1) 思路: A Exam 思路:水题 代码: #include<bits/stdc++.h> using namespace std; int main(){ int k; scanf("%d",&k); ],s2[]; scanf("%s%s",s1,s2); ; int n=strlen(s1); ;i<n;i++)…
A:Exam Solved. 温暖的签. #include<bits/stdc++.h> using namespace std; ; int k; char str1[maxn], str2[maxn]; int main() { while(~scanf("%d",&k)) { scanf(); scanf(); , cnt2 = ; ); ; i <= len; ++i) { if(str1[i] == str2[i]) cnt1++; else cnt…
I NEED A OFFER! Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other) Total Submission(s) : 1   Accepted Submission(s) : 1 Problem Description Speakless很早就想出国,现在他已经考完了所有需要的考试,准备了所有要准备的材料,于是,便需要去申请学校了.要申请国外的任何大学,你都要交纳一定的申请费用…
F. Contestants Ranking time limit per test:1 second memory limit per test:24 megabytes input:standard input output:standard output Ahmad is one of the best students in HIAST, and also a very good problems Solver. In the time you will spend reading th…
E. Arrange Teams time limit per test:2 seconds memory limit per test:64 megabytes input:standard input output:standard output Syrian Collegiate Programming Contest (SCPC) is the qualified round for the Arab Collegiate Programming Contest. Each year S…
这场题极其简单 Solved 19 / 19 A Gym 102035A N integers 略 Solved 10 / 33 B Gym 102035B Mahmoud the Thief 用map记录所有数%m的出现次数,然后按顺序模拟,如果不同模数的种类数只剩下一种,那么就结束 Solved 2 / 14 C Gym 102035C Apple Shops 二分最大的价格 Solved 18 / 31 D Gym 102035D Coach Ayoub 略 Solved 15 / 62…
UVA 1394 And Then There Was One / Gym 101415A And Then There Was One / UVAlive 3882 And Then There Was One / POJ 3517 And Then There Was One / Aizu 1275 And Then There Was One (动态规划,思维题) Description Let's play a stone removing game. Initially, n ston…
layout: post title: (寒假开黑gym)2018 ACM-ICPC, Syrian Collegiate Programming Contest(爽题) author: "luowentaoaa" catalog: true tags: mathjax: true - codeforces - DP - 状态压缩 - LCA 传送门 付队! C - Greetings! (状态压缩) 题意 给N种信件,你可以任意选择K种信封装信件,问你最少的浪费是多少 不能大的信件装…
Problem A. Arrangement of Contest 题目连接: http://codeforces.com/gym/100269/attachments Description Little Dmitry and little Petr want to arrange a contest. Their little friends submitted several task proposals and now Dmitry and Petr want to select som…
layout: post title: (寒假开黑gym)2017-2018 ACM-ICPC German Collegiate Programming Contest (GCPC 2017) author: "luowentaoaa" catalog: true tags: mathjax: true - codeforces 传送门 付队! 许老师! B.Buildings (polya定理) 题意 B:给你m面墙,每面墙是n*n的格子,你有c种颜色,问你有多少种涂色方案.用po…
layout: post title: (寒假开黑gym)2018 ACM-ICPC, Syrian Collegiate Programming Contest author: "luowentaoaa" catalog: true tags: mathjax: true - codeforces 传送门 付队! 许老师! Hello SCPC 2018! (签到) #include<bits/stdc++.h> using namespace std; typedef…
传送门 Description Hasan and Bahosain want to buy a new video game, they want to share the expenses. Hasan has a set of N coins and Bahosain has a set of M coins. The video game costs W JDs. Find the number of ways in which they can pay exactly W JDs su…
A - Coins Time Limit:3000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Description standard input/output Hasan and Bahosain want to buy a new video game, they want to share the expenses. Hasan has a set of N coins and Bahosain has a…
比赛链接:http://codeforces.com/gym/100861 A模拟,注意两个特殊的缩写. #include <bits/stdc++.h> using namespace std; typedef pair<string, string> pss; const string MSU = "MSU"; const string SCH = "SCH"; ; map<string, int> school; int n…
J. Polygons Intersection time limit per test:2 seconds memory limit per test:64 megabytes input:standard input output:standard output We will not waste your time, it is a straightforward problem. Given multiple polygons, calculate the area of their i…
I. Mancala time limit per test:3 seconds memory limit per test:256 megabytes input:standard input output:standard output Mancala is a traditional board game played in Africa, Middle East and Asia. It is played by two players. This game board consists…
H. Special Palindrome time limit per test:1 second memory limit per test:64 megabytes input:standard input output:standard output A sequence of positive and non-zero integers called palindromic if it can be read the same forward and backward, for exa…
G. The jar of divisors time limit per test:2 seconds memory limit per test:64 megabytes input:standard input output:standard output Alice and Bob play the following game. They choose a number N to play with. The rules are as follows: - They write eac…
D. Time to go back time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output You have been out of Syria for a long time, and you recently decided to come back. You remember that you have M friends th…
C. Palindrome Again !! time limit per test:1 second memory limit per test:64 megabytes input:standard input output:standard output Given string with N characters, your task is to transform it to a palindrome string. It's not as easy as you may think…
B. New Job time limit per test:1 second memory limit per test:64 megabytes input:standard input output:standard output This is the first day for you at your new job and your boss asks you to copy some files from one computer to other computers in an…
A. Who is the winner? time limit per test:1 second memory limit per test:64 megabytes input:standard input output:standard output A big marathon is held on Al-Maza Road, Damascus. Runners came from all over the world to run all the way along the road…
https://codeforces.com/gym/100608 题意: 两个人玩游戏,每个人有一个长为d的b进制数字,两个人轮流摇一个$[0,b-1]$的骰子,并将选出的数字填入自己的d个空位之中 最后数字大的人赢 有两种玩法,第一个是轮流玩,一个是第一个人玩d次之后,第二个人玩 两个人都非常聪明,求第一个人的最大胜率 $d,b<=10,(b+1)^d<=3000$ 题解: 很有意思的是,他保证了$(b+1)^d<=3000$,也就是b+1进制数字不会超过3000的大小 我们考虑暴搜…
题目传送门 传送门 题目大意 给定一个长度为$n$的序列,要求划分成最少的段数,然后将这些段排序使得新序列单调不减. 考虑将相邻的相等的数缩成一个数. 假设没有分成了$n$段,考虑最少能够减少多少划分. 我们将这个序列排序,对于权值相同的一段数可以任意交换它们,每两个相邻数在原序列的位置中如果是$i, i + 1$,那么划分的段数就可以减少1. 每次转移我们考虑添加值相同的一段. 每次转移能不能将减少的段数加一取决于当前考虑的数在前一段内有没有出现以及有没有作为最左端点. 因此我们记录一个决策与…
原文链接https://www.cnblogs.com/zhouzhendong/p/AGC002F.html 题目传送门 - AGC002F 题意 给定 $n,k$ ,表示有 $n\times k$ 个球,其中,颜色为 $1,2,\cdots, n$ 的球各有 $k$ 个. 将这些球任意排列成一排,对于每一种颜色,将这种颜色的球的最左边的那个涂成颜色 $0$ . 问最终可以得到多少种不同的排列. $1\leq n,k\leq 2000,{\rm Mod} = 10^9 +7$ 题解 首先当 $…
题目链接:https://codeforces.com/gym/102028/problem/C Lewis likes playing chess. Now he has n rooks on the chessboard with $n$ rows and $n$ columns. All rows of the chessboard are labelled with $1$ through $n$ from top to bottom. All columns of the chessb…