permutation codeforces another problem

YARP(Yet Another Reverse Proxy)Yarp是什么?

Azure应用服务用YARP取代了Nginx,获得了80%以上的吞吐量。他们每天处理160B多个请求(1.9 m RPS)。这是微软的一项了不起的技术创新。 首先我们来介绍一下什么是Yarp Yarp是什么? YARP(Yet Another Reverse Proxy)是一个开源的、高性能的反向代 ......
Another Reverse Proxy YARP Yarp

AtCoder Beginner Contest 335 G Discrete Logarithm Problems

洛谷传送门 AtCoder 传送门 考虑若我们对于每个 \(a_i\) 求出来了使得 \(g^{b_i} \equiv a_i \pmod P\) 的 \(b_i\)(其中 \(g\) 为 \(P\) 的原根),那么 \(a_i^k \equiv a_j \pmod P\) 等价于 \(kb_i \ ......
Logarithm Beginner Discrete Problems AtCoder

Hey left 1 Codeforces Round 918 (Div. 4)

题目链接 A. 3个数,其中2个数相同,输出不相同的那个 可以用if else判断,较为麻烦 用的map,输出出现一次的 #include <bits/stdc++.h> using namespace std; const int N=1e5+10; void solve(){ map<int,i ......
Codeforces Round left Hey 918

CodeForces 1312G Autocompletion

洛谷传送门 CF 传送门 考虑直接在题目给的 Trie 上 dp,设 \(f_u\) 为打出 \(u\) 结点的串的最小代价。 首先我们有 \(f_u \gets f_{fa_u} + 1\)。 我们有 \(f_u \gets \min\limits_v f_v + t + 1\),要求 \(u\) ......
Autocompletion CodeForces 1312G 1312

Educational Codeforces Round 152 (Rated for Div. 2)

layout: ../../layouts/MarkdownPostLayout.astro title: 'Educational Codeforces Round 152 (Rated for Div. 2)' pubDate: 2024-01-11 description: '一些训练' au ......
Educational Codeforces Round Rated 152

codeforces 918 div4

C 题意 : 给定一些数,问这些数的和是不是完全平方数(5*5这样) #include<cmath> #include<iostream> #define ll long long using namespace std; bool issq(ll n){ ll root = sqrt(n); re ......
codeforces div4 918 div

CF1006E Military Problem 题解

CF1006E Military Problem 题解 题意 给定一颗有 \(n \thinspace (2 \leq n \leq 2 \times 10^5)\) 个节点的树,树根为 \(1\)。 对于每个节点 \(i \thinspace (2 \leq i \leq n)\) 都有它的父节点 ......
题解 Military Problem 1006E 1006

P4137 Rmq Problem / mex

题意 给定一个长度为 \(n\) 的数组。 \(q\) 次询问,每次询问区间 \(mex\)。 Sol 考虑主席树维护区间 \(mex\)。 不难发现可以考虑维护当前所有点的最后出现的下标。 直接套板子即可。 Code #include <iostream> #include <algorithm> ......
Problem P4137 4137 Rmq mex

gurobipy: Gurobi Optimizer is a mathematical optimization software library for solving mixed-integer linear and quadratic optimization problems

Project description The Gurobi Optimizer is a mathematical optimization software library for solving mixed-integer linear and quadratic optimization p ......

http://www.nfls.com.cn:20035/contest/1878/problem/5

http://www.nfls.com.cn:20035/submission/781868 #include<bits/stdc++.h> using namespace std; int N, ct[45], b[25], ans, a[45][5]; void dfs(int t, int s ......
contest problem 20035 http 1878

CodeForces 1329D Dreamoon Likes Strings

洛谷传送门 CF 传送门 考虑构造一个新串 \(t\),只保留原串 \(s_{i - 1} = s_i\) 的字符 \(s_i\)。设 \(a_i\) 为 \(t_i\) 在原串的位置。 那么新串上我们有两种操作: \(\forall i\),删除 \(t_i\)(相当于删除原串中的 \([a_i, ......
CodeForces Dreamoon Strings 1329D Likes

CodeForces 1237H Balanced Reversals

洛谷传送门 CF 传送门 容易想到把 \(s, t\) 分成长度为 \(2\) 的段考虑。容易发现 \(00, 11\) 的个数在操作过程中不会改变,所以若两串的 \(00\) 或 \(11\) 个数不相等则无解。 考虑依次对 \(i = 2, 4, \ldots, n\) 构造 \(s[1 : i ......
CodeForces Reversals Balanced 1237H 1237

vp Codeforces Round 915 (Div. 2)

vp还是比正式打舒服一些。。AB很顺畅,A题。。我只能说玩MC的都一眼秒了好吧 C题,我卡住了,结论非常好推,我直接退出来了,但是,问题是我对特例的判断不是很熟悉,或者说不是很敏感。这是一个大问题,我在wa on test 2的时候,第一反应是去看看这个算法整个有没有什么问题,事实上是没有的那么问题 ......
Codeforces Round 915 Div vp

Codeforces [Hello 2024]

Codeforces Hello 2024 主打一个昏了头 A. Wallet Exchange #include <bits/stdc++.h> #define endl '\n' //#define int long long using namespace std; const int N = ......
Codeforces Hello 2024

CodeForces 1379E Inverse Genealogy

洛谷传送门 CF 传送门 \(n\) 为偶数显然无解。 否则我们可以构造一棵 \(n\) 个点的完全二叉树,当 \(n + 1\) 是 \(2\) 的幂时满足 \(m = 1\),否则 \(m = 0\)。 当 \(n \ge 5\) 时可以递归至 \((n - 2, m - 1)\),再挂一个叶子 ......
CodeForces Genealogy Inverse 1379E 1379

CodeForces 1919F2 Wine Factory (Hard Version)

洛谷传送门 CF 传送门 题目看着感觉很像最大流,不妨建模,\(S \to i\),容量为 \(a_i\);\(i \to T\),容量为 \(b_i\);\(i \to i + 1\),容量为 \(c_i\)。答案是这个图的最大流。 考虑最大流转最小割。观察到 \(S \to i\) 和 \(i ......
CodeForces Factory Version 1919F2 1919F

CodeForces 1919E Counting Prefixes

洛谷传送门 CF 传送门 考虑一个很类似的题。我们把正数和负数分开来考虑,最后用 \(0\) 连接一些连续段,形如 \(0 - \text{正} - 0 - \text{正} - 0 - \text{负}\)。 先考虑正数。设 \(f_{i, j}\) 为考虑了 \(\ge i\) 的正数,形成了 ......
CodeForces Counting Prefixes 1919E 1919

【题解】Codeforces 1876G Clubstep

首先考虑暴力的贪心。 从 \(r\) 到 \(l\) 依次遍历,若 \(a_i < x\) 则一直进行题目中的操作。 正确性是能保证的,因为选后面的 \(j\) 只能 \(+ 1\),而选 \(i\) 可以 \(+2\),且 \(i\) 前面的部分都是 \(+1\)。 考虑转化一下,把对 \(i\) ......
题解 Codeforces Clubstep 1876G 1876

【题解】Codeforces 1852D Miriany and Matchstick

首先考虑到第一行是固定的,先去掉第一行的贡献。 接下来会有一个 \(O(n^2)\) 的 \(\text{DP}\)。 考虑设 \(f_{i, 0 / 1, j}\) 为考虑了 \(1\sim i\) 列的放置,第 \(i\) 列填 \(\text{A / B}\) 且对数为 \(j\) 是否可行。 ......
题解 Codeforces Matchstick Miriany 1852D

P7830 [CCO2021] Through Another Maze Darkly

最坏走 \(n^2\) 次后,所有点的激光指向器都指向其父亲,此时走的就是欧拉序了,所以问题集中在优化前面的 \(n^2\) 次。 称激光指向器指向其父亲的结点为好点,激光指向器不指向其父亲的结点为坏点。 考虑好坏点间的转化,模拟后不难发现好点始终是好点,坏点经过一次遍历后变为好点。 而又因为坏点在 ......
Another Through Darkly P7830 7830

CF1917D Yet Another Inversions Problem 题解

官方题解。 思路 首先可以把 \(a\) 数组分成 \(n\) 块,每块都是长为 \(k\) 的 \(q\) 数组。于是我们可以把答案拆成两部分计算:块内的贡献和块外的贡献。对于块内,\(p_i\) 都是一样的,因此可以直接消去,计算的实际上就是 \(q\) 序列的逆序对数,把这个值 \(\time ......
题解 Inversions Another Problem 1917D

vp Educational Codeforces Round 160 (Rated for Div. 2)

ABC很顺畅,没有卡住然后到最后D都做不出来 D我感觉是一个类似计数dp的东西但是我找不到统计的规律但是可以得到一些性质:一个数字如果想被删掉,那它直到它左边的比它小的数字为止所有数字都要先删掉,它才能被删掉 发现自己如果不去想DP,会去往贪心的方向想,这题就是那种贪心没法完全被判断掉的因为贪心也有 ......
Educational Codeforces Round Rated 160

codeforces比赛(4):codeforces hello_2024

A、Wallet Exchange 跳转原题点击此:A题地址 1、题目大意 经典贪心:A和B玩游戏,两人依次进行以下两个操作(注意这两个操作是依次进行,而不是选择操作!!!)是:1、交换钱包或保留钱包;2、从玩家当前钱包中取出1枚硬币(注意不能为0)。 A先走,并且当某位玩家无法做出有效举动时,另一 ......
codeforces hello 2024

CodeForces Hello 2024 个人题解(A~C)

A. Wallet Exchange 时间限制: 1秒 内存限制: 256兆 输入: 标准输入 输出: 标准输出 Alice and Bob are bored, so they decide to play a game with their wallets. Alice has a coins ......
题解 CodeForces Hello 个人 2024

The Biggest Water Problem

地址 #include<bits/stdc++.h> using namespace std; typedef long long ll; int main() { ll n; cin>>n; ll sum=0; while(n>10){ ll sum=n; ll d=0; while(sum){ ......
Biggest Problem Water The

[Codeforces] CF1553D Backspace

CF1553D Backspace 说实话这题不配绿题 题目传送门 题面 给你两个字符串 \(S,T\) ,问你能否通过将 \(S\) 中的若干个数换成 Backspace 来使其变成 \(T\) 。Backspace 能删去前一个输入的字符。 思路 很明显,如果将一个字符换成Backspace,那 ......
Codeforces Backspace 1553D 1553 CF

[Codeforces] CF1551C Interesting Story

CF1551C Interesting Story 题目传送门 题意 给定 \(n\) 个仅由 \(\texttt{a,b,c,d,e}\) 组成的单词 (\(n \le 2\times 10^5\)),从其中选出尽可能多的单词,使得存在某个字母在这些单词中出现的次数比其他所有字母的出现次数之和还要 ......
Interesting Codeforces 1551C Story 1551

CF1801F Another n-dimensional chocolate bar

更好的阅读体验 CF1801F Another n-dimensional chocolate bar 高妙的数论分块优化 DP。 第一步设计状态就有很大问题,如果直接设 \(f_{i,j}\) 表示前 \(i\) 个数成绩为 \(j\) 那就死了。这完全没有利用到整除的性质。正确做法是设 \(f_ ......

Codeforces Round 917 (Div. 2)

Codeforces Round 917 (Div. 2) 康复训练 A. Least Product #include <bits/stdc++.h> #define endl '\n' using namespace std; int n; void solve(){ cin >> n; int ......
Codeforces Round 917 Div

Codeforces Round 918 (Div. 4)

D. Unnatural Language Processing 给字符串元素按要求间隔”.“ #include<bits/stdc++.h> using namespace std; void solve(){ int n; string s; cin>>n>>s; string o=s; for ......
Codeforces Round 918 Div
共1830篇  :1/61页 首页上一页1下一页尾页