- 博客(206)
- 收藏
- 关注
原创 CodeForces Round #596 Div. 2 TV Subscriptions 尺取法
#include<bits/stdc++.h>using namespace std;const int maxn=1e6+5;int a[maxn];set<int> s;map<int,int> mp;int main(){ int t,n,k,d,ans; scanf("%d",&t); while(t--&...
2019-10-28 15:46:11
197
原创 CodeForces 1234F 状压DP
#include<bits/stdc++.h>using namespace std;typedef long long ll;const int maxn=20;int dp[1<<maxn],vis[maxn],mask,cnt,ans;char s[1000005];int main(){ scanf("%s",s); for(int ...
2019-10-08 21:09:15
217
原创 2018 ACM-ICPC 青岛站 L ZOJ 4069 容斥+枚举+组合计数
//https://paste.ubuntu.com/p/727RRrKPn7/#include<bits/stdc++.h>using namespace std;typedef long long ll;const int maxn=1e5+5;const ll mod=1e9+7;ll fact[maxn],fact_inv[maxn],pow_2_inv[maxn...
2018-11-07 21:03:30
768
原创 2018 ACM-ICPC 青岛站 F 找规律打表
#include<bits/stdc++.h>using namespace std;const int maxn=1025;int dp[maxn][maxn],pre[maxn];void init(int x1,int y1,int x2,int y2){ int now=x2-x1+1; if(now==1) { dp[x1]...
2018-11-05 00:31:06
441
原创 2018 ACM-ICPC 青岛站 E 贪心
#include<bits/stdc++.h>using namespace std;const int maxn=1e5+5;typedef long long ll;ll a[maxn],b[maxn];int n;bool check(ll level,ll sum){ for(int i=1;i<=n;i++) { sum-...
2018-11-05 00:30:21
327
原创 ZOJ 4027 Sequence Swapping DP+滚动数组优化
#include<bits/stdc++.h>using namespace std;typedef long long ll;const ll inf=0x3f3f3f3f3f3f3f3f;const int maxn=2*1e3+5;char s[maxn];int a[maxn];ll dp[2][maxn],sum[maxn],ans;int main(){...
2018-10-31 20:55:39
175
原创 2018 ACM-ICPC 沈阳站 Problem K. Let the Flames Begin 具体数学
#include<bits/stdc++.h>using namespace std;typedef long long ll;ll f(ll n,ll m,ll k){ if(m*k<=n) return m*k; if(k>n) return (f(n-1,m-1,k)+(k-1)%n)%n+1; ll ...
2018-10-25 19:19:09
1073
原创 2018 ACM-ICPC 沈阳站 Problem L. Machining Disc Rotors 几何
#include<bits/stdc++.h>using namespace std;const int maxn=205;const double pi=acos(-1);const double eps=1e-12;typedef struct{double xi,yi,ri,thetas,thetat;} node1;typedef struct{double th...
2018-10-23 12:32:24
973
原创 2018 ACM-ICPC 沈阳站 Problem I. Distance Between Sweethearts FWT
#include<bits/stdc++.h>using namespace std;typedef unsigned long long ll;const int maxn=1e4+5;int UIB,UAB,UGB,UIG,UAG,UGG,I[maxn],A[maxn],G[maxn],pre_op,now_op;ll temp[maxn],num[2][maxn],r...
2018-10-23 07:50:00
580
原创 hdu 2993 卡输入挂??? 斜率优化
#include<bits/stdc++.h>using namespace std;typedef long long ll;const int maxn=1e5+5;const ll inf=0x3f3f3f3f3f3f3f3f;int lis[maxn],head,tail;char IO_BUF[maxn*250];char *buf=IO_BUF;doubl...
2018-10-19 23:15:15
187
原创 hdu 2829 Lawrence DP 四边形优化(斜率优化)+wps二分 模板
//斜率优化+WQS二分#include<bits/stdc++.h>using namespace std;typedef long long ll;const int maxn=1e3+5;const ll inf=0x3f3f3f3f3f3f3f3f;int n,k,lis[maxn],head,tail,w[maxn];ll dp[maxn],a[maxn],s...
2018-10-18 21:19:16
198
原创 hdu 3507 Print Article 斜率优化DP
#include<bits/stdc++.h>using namespace std;typedef long long ll;const int maxn=5*1e5+5;const ll inf=0x3f3f3f3f3f3f3f3f;int n,m,lis[maxn],head,tail;ll dp[maxn],a[maxn];ll get_up(int i,int...
2018-10-18 19:49:06
149
原创 2018 ACM-ICPC 南京站 B Tournament dp+决策单调性+wqs二分
#include <bits/stdc++.h>using namespace std;#define ll long long#define inf 0x3f3f3f3f3f3f3f3f#define N 10010ll n,k,s[N],f[N],w[N],ans=0,q[N];inline ll calc(ll j,ll i){ ll mid=i+j+1&...
2018-10-17 21:55:13
1112
原创 2018 ACM-ICPC 南京站 E Eva and Euro coins
#include <bits/stdc++.h>using namespace std;const int maxn=1e6+5;char s[maxn],t[maxn],sum[maxn];int n,k;void up_date(int now){ while(now<=n) { sum[now]=sum[now]^1; ...
2018-10-16 22:19:31
709
原创 2018 ACM-ICPC 南京站 G Pyramid 找规律
#include<bits/stdc++.h>using namespace std;typedef long long ll;const ll mod=1e9+7;const ll inv24=41666667;int main(){ int t; ll n; scanf("%d",&t); while(t--&&...
2018-10-15 13:26:07
1681
原创 2018 ACM-ICPC 南京站 D Country Meow 最小球覆盖(模拟退火&三分)
//模拟退火#include <iostream>#include<cstdio>#include<algorithm>#include<cstring>#include<cmath>using namespace std;const double eps=1e-8;struct point3D{ double...
2018-10-14 21:52:07
3716
原创 2018 ACM-ICPC 南京站 J Prime Game 素数筛
#include<bits/stdc++.h>using namespace std;typedef long long ll;const int maxn=1e6+5;int f[maxn],prime[maxn],cnt,a[maxn],n;vector<int> pre[maxn];vector<int> pos[maxn];void in...
2018-10-14 18:14:55
1140
原创 2018南京站网络赛 J SUM 整数分块进阶
#include<bits/stdc++.h>using namespace std;typedef long long ll;const int maxn=2*1e7+5;int sum[maxn];void init(){ for(int i=2;i*i<maxn;i++) { int tp=i*i; if(sum...
2018-09-02 16:00:41
383
原创 hdu 6304 数学题+找规律+卡时间
#include<bits/stdc++.h>using namespace std;typedef long long ll;const ll mod=1e9+7;ll ans,sum,inv2=500000004;ll cal(ll n){ sum=0; while(n) { sum+=n; n>>=...
2018-08-31 11:13:31
210
原创 hdu 6438 贪心+优先队列
#include<bits/stdc++.h>using namespace std;typedef long long ll;map<int,int> f;int main(){ int t,n,cnt,tp; ll ans; scanf("%d",&t); while(t--&&scanf("%d",&...
2018-08-30 17:58:25
164
原创 hdu 6424 数学
#include<bits/stdc++.h>using namespace std;const int inf=0x3f3f3f3f;pair<int,int> a1,a2,b1,b2;pair<pair<int,int>,pair<int,int> > aa,bb;pair<int,int> mp(int a,...
2018-08-24 20:27:19
222
原创 hdu 6428 莫比乌斯反演+积性函数线性筛
#include<bits/stdc++.h>using namespace std;typedef long long ll;const int maxn=1e7+5;const ll mod=1<<30;int pow_bit[maxn],pow_num[maxn],f[maxn],f2[maxn],f3[maxn],prime[maxn],tot;boo...
2018-08-24 17:49:16
268
原创 hdu 6435 枚举好题
#include<bits/stdc++.h>using namespace std;typedef long long ll;const int maxn=6;const int inf=0x3f3f3f3f;ll a[1<<maxn+5],b[1<<maxn+5];int t,n,m,k,x[maxn+5],val;void del(ll *...
2018-08-22 17:49:39
342
原创 hdu 6397 容斥(我写NTT+快速幂还是T了)
#include<bits/stdc++.h>using namespace std;typedef long long ll;const ll mod=998244353;const int maxn=2*1e5+5;ll fact[maxn],f[maxn],inv[maxn],cal[maxn];void init(){ fact[0]=f[0]=inv[...
2018-08-15 18:11:07
525
原创 hdu 6395 整数分块+矩阵快速幂
#include<bits/stdc++.h>using namespace std;typedef long long ll;const ll mod=1e9+7;typedef struct node{ ll mat[4][4];}matrix;matrix mul(matrix a,matrix b){ matrix res; for(i...
2018-08-13 21:28:51
363
原创 hdu 6363 数论多种知识集合(欧拉降幂+莫比乌斯反演+约数枚举+组合数计算+快速幂+斐波那契+GCD加强版)
#include<bits/stdc++.h>using namespace std;typedef long long ll;const ll mod=1e9+7;const int maxn=2*1e6+5;const int maxm=1e6+5;ll fact[maxn],f[maxn],inv[maxn];bool check[maxm];int mu[ma...
2018-08-08 23:56:19
345
原创 hdu 6356 区间更新反转ST表,对时间卡的很严格
#include<bits/stdc++.h>using namespace std;const int maxn=1e5+5;unsigned x,y,z,mp[maxn][18];int dis[maxn];unsigned RNG61(){ x=x^(x<<11); x=x^(x>>4); x=x^(x<<...
2018-08-07 18:19:44
144
原创 牛客网 暑期集训第五场 树状数组+概率思维
时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288K64bit IO Format: %lld题目描述Kanade has n boxes , the i-th box has p[i] probability to have an diamond of d[i] size.At the beginning , Kanade has...
2018-08-02 19:05:18
198
原创 hdu 6330 模拟水题
#include<bits/stdc++.h>using namespace std;const int maxn=105;int t,n,m,k;char mp[maxn][maxn];int main(){ scanf("%d",&t); while(t--&&scanf("%d%d%d",&n,&m,&...
2018-08-02 17:52:26
398
原创 hdu 6333 莫队算法+组合数学
#include<bits/stdc++.h>using namespace std;typedef long long ll;const ll mod=1e9+7;const ll maxn=1e5+5;ll fact[maxn],f[maxn],inv[maxn];struct node{int l,r,index,block;ll res;}a[maxn];int...
2018-08-02 16:51:57
188
原创 hdu 6322 打表找规律
#include<bits/stdc++.h>using namespace std;int main(){ int t,n; scanf("%d",&t); while(t--&&scanf("%d",&n)!=EOF) printf("%d\n",n==1?5:n+5); return 0;}..
2018-07-31 17:21:19
219
原创 hdu 6321 状压dp
#include<bits/stdc++.h>using namespace std;const int mod=1e9+7;int mp[1<<10],ans[15],cnt[1<<10];char s[15];int main(){ int t,n,m,u,v; scanf("%d",&t); for(int i...
2018-07-31 17:19:22
181
原创 hdu 6319 单调队列+数据结构
#include<bits/stdc++.h>using namespace std;typedef long long ll;ll a[10000005];int main(){ int t,n,m,k; ll p,q,r,mod,ans1,ans2; scanf("%d",&t); while(t--&&scanf...
2018-07-31 17:18:30
149
原创 第九届山东省ACM省赛H题 bfs
#include<bits/stdc++.h>using namespace std;typedef long long ll;const int maxn=1e7+5;const int mod=1e9+7;int n,m,k;int mp[15][10005],f[15][10005];typedef struct{int l,r;}node;int main()...
2018-05-22 22:36:42
227
原创 2018年山东省ACM省赛B题 二分+二分图匹配
#include<bits/stdc++.h>using namespace std;const int maxn=505;int mp[maxn][maxn],g[maxn*2][maxn*2],n,m,used[2*maxn],link[maxn*2],cnt,nb[maxn*maxn];map<int,int> vis;bool found(int x){...
2018-05-22 11:28:59
335
原创 hdu 1852 Beijing 2008 简单数论
#include<bits/stdc++.h>using namespace std;typedef long long ll;const int maxn=1e4+5;ll quick_mod(ll n,ll m,ll mod){ ll res=1; while(m) { if(m&1) res=res...
2018-05-12 16:10:21
177
原创 hdu 1851 A Simple Game 简单博弈
#include<bits/stdc++.h>using namespace std;typedef long long ll;const int maxn=1e5+5;const int inf=0x3f3f3f3f;const int mod=1e9+7;int main(){ int t,n,m,p,q,f; scanf("%d",&t);...
2018-05-12 16:09:25
170
原创 hdu 2569 彼岸 简单dp
#include<bits/stdc++.h>using namespace std;typedef long long ll;const int maxn=1e5+5;const int inf=0x3f3f3f3f;const int mod=1e9+7;ll a[maxn];int main(){ int t,n,m; a[0]=1; a[...
2018-05-12 16:07:49
152
原创 CF980C Posterized 贪心
#includeusing namespace std;int a[100005],f[256],n,k;int main(){ scanf("%d%d",&n,&k); for(int i=1; i<=n;++i) scanf("%d",a+i); memset(f,-1,sizeof f); for(int i=1;i<=n;++i) { if(f[a[i]]==-1
2018-05-09 23:26:19
257
原创 2018年山东省第九届acm省赛F题,容斥原理
#include<bits/stdc++.h>using namespace std;typedef long long ll;const ll mod=1e9+7;int main(){ ll n,l1,l2,l3,l4,r1,r2,r3,r4,tp1l,tp2l,tp1r,tp2r,ans; scanf("%lld\n",&n); whil...
2018-05-07 23:17:33
1605
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人