首页 > TAG信息列表 > 5147
Solution -「AGC 036D」「AT 5147」Negative Cycle
\(\mathcal{Descriprtion}\) Link. 在一个含 \(n\) 个结点的有向图中,存在边 \(\lang i,i+1,0\rang\),它们不能被删除;还有边 \(\lang i,j,-1\rang~(i<j)\) 和 \(\lang i,j,1\rang~(i>j)\),删除一条边的代价为 \(a_{i,j}\)。求使得图无负环的最小删边代价和。 \(n\le500\)Leetcode-5147 Decrease Elements To Make Array Zigzag(递减元素使数组呈锯齿状)
1 #define _for(i,a,b) for(int i = (a);i < b;i ++) 2 typedef long long ll; 3 using namespace std; 4 5 class Solution 6 { 7 public: 8 int movesToMakeZigzag(vector<int>& nums) 9 {10 int rnt1 = 0;11 iB - Sequence II (HDU 5147)
Long long ago, there is a sequence A with length n. All numbers in this sequence is no smaller than 1 and no bigger than n, and all numbers are different in this sequence. Please calculate how many quad (a,b,c,d) satisfy: 1. 1≤a<b<c<d≤n1≤a<b&l