#include<bits/stdc++.h>using namespace std;const long long mod=998244353;long long f[200007][2],g[200007][2];long long a[200007],b[200007],c[200007];int n,k,cnt1,cnt2;long long qpow(long long a,long long p){ long long ans=1; while(p){ i…
#define HAVE_STRUCT_TIMESPEC#include<bits/stdc++.h>using namespace std;long long a[300007],b[300007];long long dp[300007][5];long long ans;int main(){ ios::sync_with_stdio(false);//多组数据输入cin,cout容易超时 cin.tie(NULL); cout.tie(NULL); int q; cin>>…
#include<bits/stdc++.h>using namespace std;int a[300007];long long sum[300007],tmp[300007],mx[300007];int main(){ int n,m,k; cin>>n>>m>>k; for(int i=1;i<=n;++i){ cin>>a[i]; sum[i]=sum[i-1]+a[i];//前缀和 } long long ans=0; for…
C. Playlist time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You have a playlist consisting of nn songs. The ii-th song is characterized by two numbers titi and bibi — its length and beauty…
#define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; ],t[]; int n,m; ][];//nex[i][j]表示i位置以字母j+'a'最先出现的位置 ][];//把t分割为t1和t2,dp[i][j]表示t1长度为i,t2长度为j时,在字符串s中的最小位置 int check(int x){ int y=m-x; dp[][]=; ;i<=x;++i) ;j<=y;++j){ &a…
题意:给你一个长度为\(2*n-1\)的字符串\(s\),让你构造一个长度为\(n\)的字符串,使得构造的字符串中有相同位置的字符等于\(s[1..n],s[2..n+1],...,s[n,2n-1]\)中的位置上的字符. 题解:不难发现,\(s\)中的奇数位字符就是我们要的答案. 代码: int t; int n; char s[N]; int main() { //ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); t=read(); wh…
Problem Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship Time Limit: 2000 mSec Problem Description Input Output The only line should contain the minimal number of days required for the ship to reach the point (x2,y2)(x2,y2). If it…
Problem Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems Time Limit: 3000 mSec Problem Description Input The input contains a single line consisting of 2 integers N and M (1≤N≤10^18, 2≤M≤100). Output Print one integer, the total n…
Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings 题目连接: http://codeforces.com/contest/985/problem/F Description You are given a string s of length n consisting of lowercase English letters. For two given strings s an…
Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes 题目连接: http://codeforces.com/contest/985/problem/E Description Mishka received a gift of multicolored pencils for his birthday! Unfortunately he lives in a monochrome w…
Educational Codeforces Round 63 (Rated for Div. 2)题解 题目链接 A. Reverse a Substring 给出一个字符串,现在可以对这个字符串进行一次翻转,问是否存在一种方案,可以使得翻转后字符串的字典序可以变小. 这个很简单,贪心下就行了. 代码如下: Code #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 3e5…
Educational Codeforces Round 48 (Rated for Div. 2) C. Vasya And The Mushrooms 题目链接:https://codeforces.com/contest/1016/problem/C 题意: emmm,说不清楚,还是直接看题目吧. 题解: 这个题人行走的方式是有一定的规律的,最后都是直接走到底,然后从另外一行走回来.并且通过画图观察,会发现他走到格子的时间会有一定的规律. 所以就维护几个前缀和就行了,从1到n枚举一下,还要…