Codeforces Round #581 (Div. 2)】的更多相关文章

Codeforces Round #581 (Div. 2)-E. Natasha, Sasha and the Prefix Sums-动态规划+组合数学 [Problem Description] ​ 给你\(n\)个\(1\),\(m\)个\(-1\),他们任意排列有\(\frac{(n+m)!}{n!\cdot m!}\)中排列,每种排列都有一个最大前缀和(可能为\(0\)),求所有排列的最大前缀和之和为多少. [Solution] ​ 定义\(dp[i][j]\)表示有\(i\)个\(…
A:暴力. #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #define rep(i,l,r) for (int i=(l); i<=(r); i++) typedef long long ll; using namespace std;   ; int n; char s[N];   int main(){ scanf(); n=strlen(s+)…
题意:https://codeforc.es/problemset/problem/1204/D2 给你一个01串,如:0111001100111011101000,让你改这个串(使0尽可能多,任意 l~r 的LIS最长上升子序列长度不变). 问:0111001100111011101000 答:0011001100001011101000 思路: 参考题解:考虑什么串无法该变. 1. 10无法被改变(我们称为固定串),00,01,11都可以改. 2. 固定串+固定串(无法被改变). 3. 1+…
C. Anna, Svyatoslav and Maps time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output The main characters have been omitted to be short. You are given a directed unweighted graph without loops with n v…
D2. Kirk and a Binary String (hard version) time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output The only difference between easy and hard versions is the length of the string. You can hack this pro…
B. Mislove Has Lost an Array time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Mislove had an array a1, a2, ⋯, an of n positive integers, but he has lost it. He only remembers the following facts…
A. BowWow and the Timetable time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output In the city of Saint Petersburg, a day lasts for 2100 minutes. From the main station of Saint Petersburg, a train dep…
#define HAVE_STRUCT_TIMESPEC#include<bits/stdc++.h>using namespace std;char s[100007];int main(){ cin>>s+1; int n=strlen(s+1); int cnt=0; for(int i=n;i>=1;--i){//从后向前,保证后面的解都是合法的情况下 if(s[i]=='1'){//如果当前位置的数字是1 if(cnt)//i后面1的个数小于0的个数,此时如果把i位…
Codeforces Round #581(Div. 2) CF 1204 A. BowWow and the Timetable 题解:发现,$4$的幂次的二进制就是一个$1$后面跟偶数个$0$. 所以暴力判一下就好. Code: #include <bits/stdc++.h> #define N 110 using namespace std; char s[N]; int main() { scanf("%s", s + 1); int n = strlen(s +…
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate it n = int(raw_input()) s = "" a = ["I hate that ","I love that ", "I hate it","I love it"] for i in ran…