摘要: 1422 1 #include <cstdio> 2 #include <algorithm> 3 using namespace std; 4 struct dat 5 { 6 int s,f; 7 } a[1100]; 8 int res,n,t; 9 bool cmp(dat x,dat y) 阅读全文
posted @ 2020-02-19 15:10 IAT14 阅读(414) 评论(0) 推荐(0) 编辑
摘要: 1274 #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> #include <vector> #include <queue> using namespace std; const int inf 阅读全文
posted @ 2020-02-10 15:42 IAT14 阅读(239) 评论(0) 推荐(0) 编辑
摘要: 1341 一笔画问题 1 #include <cstdio> 2 #include <algorithm> 3 #include <stack> 4 using namespace std; 5 const int MAXN = 110000,MAXM = 510000; 6 stack <int> 阅读全文
posted @ 2020-01-18 20:49 IAT14 阅读(303) 评论(0) 推荐(0) 编辑
摘要: test 阅读全文
posted @ 2022-11-29 11:04 IAT14 阅读(73) 评论(0) 推荐(0) 编辑
摘要: 1 import argparse 2 import os 3 import numpy as np 4 import math 5 6 import torchvision.transforms as transforms 7 from torchvision.utils import save_ 阅读全文
posted @ 2022-11-15 16:56 IAT14 阅读(52) 评论(0) 推荐(0) 编辑
摘要: 先成套买,剩下的的凑,凑不齐的退一套继续凑。 #include <cstdio> #include <algorithm> using namespace std; typedef long long ll; int n,m,k; ll ans,a[210000],f[210000]; int gc 阅读全文
posted @ 2020-03-14 23:54 IAT14 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 题目让我们把序列ai重新排列,使得环上任意两个距离为ki的数字乘积之和最大。 乘法与加法不同,把四个数分为两组分别计算,再求和。 比如1 2 3 4四个数 (1 + 2)+(3 + 4) == (1 + 3) + (2 + 4) (1 * 2) + (3 * 4)>(1*3)+(2*4) 对于乘法而 阅读全文
posted @ 2020-03-14 23:48 IAT14 阅读(275) 评论(0) 推荐(0) 编辑
摘要: 首先现在操作2,一个+1,一个-1。就好比权值可以在两点之间流动。我们发现,把操作2当作边,则一个联同的子图,内部的权值是可以随便流动的。我们就这个把这个子图看多一个点。这个我们用并查集来实现。那么这个并查集内的s[i]也对应求和。 我们把操作2,都处理完了,我们再考虑操作2。对于操作1,我们连边, 阅读全文
posted @ 2020-03-14 23:45 IAT14 阅读(249) 评论(0) 推荐(0) 编辑
摘要: 让你求f(L)到f(R)的和。 我们考虑前缀和,F(x)必定是比f(x)次数高1的多项式,所以我们先插值插出f(n+1)。然后求出n+1个前缀和,插值出前缀和即可。 1 #include <cstdio> 2 using namespace std; 3 typedef long long ll; 阅读全文
posted @ 2020-03-09 16:22 IAT14 阅读(200) 评论(0) 推荐(0) 编辑
摘要: 先对8个点整体做斯坦纳树,再求出每个状态的最小代价。再看每个状态是否属于独立的,即包含的点都是成对的,我们去更新这些独立的状态即可。 1 #include <cstdio> 2 #include <cstring> 3 #include <string> 4 #include <map> 5 #in 阅读全文
posted @ 2020-03-08 10:19 IAT14 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 给出以1号点为根的一棵有根树,问每个点的子树中与它距离小于等于k的点有多少个。 所以我们边深搜边维护一个递归栈,然后不断在栈内滑动,保持窗口内边的权值和小于k。从而得出每个点会给多少个点的答案做贡献。然后使用树上差分维护。 1 #include <cstdio> 2 using namespace 阅读全文
posted @ 2020-03-02 10:51 IAT14 阅读(254) 评论(0) 推荐(0) 编辑
摘要: pass 1 #include <cstdio> 2 #include <algorithm> 3 using namespace std; 4 int t1[110000],t2[110000],rk[110000],uni[10],c[10]; 5 int n; 6 int get(int *x 阅读全文
posted @ 2020-02-23 16:13 IAT14 阅读(137) 评论(0) 推荐(0) 编辑
摘要: pass 1 #include <cstdio> 2 #include <cstring> 3 #include <cmath> 4 #include <algorithm> 5 using namespace std; 6 const int MAXN = 1100000; 7 int cnt,n 阅读全文
posted @ 2020-02-23 14:36 IAT14 阅读(188) 评论(0) 推荐(0) 编辑