i207M的“怕不是一个小时就要弃疗的flag”并没有生效,这次居然写到了最后,好评=。=

然而可能是退役前和i207M的最后一场比赛了TAT

不过打得真的好爽啊QAQ

最终结果:

看见那几个罚时没,全是我贡献的,还全是睿智的细节错误(逃

不罚时估计就进前100了啊QAQ,我好菜啊.jpg

我切了3道(然后挂了四次2333,i207M切了4道(orz),具体比赛历程太长了,不好写,就在题上写吧=。=

A.Find a Number

开场不到十分钟就有神仙切了这神仙题

因为种种原因,这题到吃晚饭的时候才开。i207M想一个很好写的$dp$思路,然而我觉得状态量太大做不了,不过后来他证明了如果有解答案不超过max(d,s/9)位(咕咕原理,如果有解在模$d$剩余系下每$d$位一定会循环),然后我们并没有想出怎么构造最优解=。=

到九点多ztb神仙成功切掉了,然后知道了构造最优解就是从高位向低位贪心,用DFS实现即可,于是i207M一发A掉了orz

至于那个简单的$dp$就是设$dp[i][j][k]$表示$i$位时模$d$为$j$数位和为$k$是否可行,然后用bitset优化空间,用循环移位实现转移

↓我赛后补的代码

 1 #include<cstdio>
 2 #include<bitset>
 3 #include<cstring>
 4 #include<algorithm>
 5 using namespace std;
 6 const int N=560,M=510,S=5010;
 7 bitset<M> bit[N][S];
 8 int pw[N],d,s;
 9 void outp(int pos,int sum,int mod)
10 {
11     if(!pos) return;
12     for(int i=0;i<=9;i++)
13     {
14         int newm=((mod-i*pw[pos-1]%d)%d+d)%d;
15         if(bit[pos-1][sum-i][newm])
16         {
17             printf("%d",i);
18             outp(pos-1,sum-i,newm);
19             return;
20         }
21     }
22 }
23 int main()
24 {
25     bit[0][0][0]=true;
26     scanf("%d%d",&d,&s),pw[0]=1;
27     for(int i=1;i<N;i++) pw[i]=pw[i-1]*10%d;
28     for(int i=1;i<N;i++)
29     {
30         int sum=min(9*i,s);
31         for(int j=0;j<=sum;j++)
32             for(int k=0;k<=min(9,j);k++)
33             {
34                 int mov=pw[i-1]*k%d;
35                 bitset<M> las=bit[i-1][j-k];
36                 bit[i][j]|=(las<<mov)|(las>>(d-mov));
37             }
38         if(bit[i][s][0]) outp(i,s,0),exit(0);
39     }
40     printf("-1");
41     return 0;
42 }

View Code

B. Berkomnadzor

题面都是纸老虎!

i207M最后时刻搞出正解没时间写完了orz

将每个串按照题意转化为01序列后构建一棵01Trie,然后对于一个黑名单地址其子树都必须不可行,对于一个白名单地址从根节点到它的链都必须可行。因为树高只有32我们每个串暴力向上跳检查即可,注意判断无解时的细节(i207M和ZRQ都被阴了,论WA on test 217是什么体验=。=

这是i207M赛后的代码我咕掉了

  1 #pragma GCC optimize(2)
  2 #include<iostream>
  3 #include<cstdio>
  4 #include<cstdlib>
  5 #include<algorithm>
  6 #include<vector>
  7 #include<string>
  8 #include<cstring>
  9 #include<queue>
 10 #include<set>
 11 #include<map>
 12 #include<bitset>
 13 #include<sstream>
 14 using namespace std;
 15 #define ri register int
 16 #define LL long long
 17 #define il inline
 18 #define mp make_pair
 19 #define pb push_back
 20 #define pairint pair<int,int>
 21 #define fi first
 22 #define se second
 23 #define gc getchar
 24 template<class T>il void in(T &x)
 25 {
 26     x=0; bool f=0; char c=gc();
 27     while(c<'0'||c>'9')
 28     {
 29         if(c=='-') f=1;
 30         c=gc();
 31     }
 32     while(c>='0'&&c<='9') x=x*10+(c^'0'),c=gc();
 33     if(f) x=-x;
 34 }
 35 #undef gc
 36 #define int LL
 37 int tre[32*200005][2],cnt=1;
 38 int fa[32*200005];
 39 int n;
 40 char tc[100];
 41 const int rt=1;
 42 bool del[32*200005],hv[32*200005],phv[32*200005];
 43 int d[200005],cntd,h[200005],cnth;
 44 void inser(int num,int mx,int typ)
 45 {
 46     int x=rt;
 47     if(mx==0)
 48     {
 49         if(typ) del[x]=1,d[++cntd]=x;
 50         else hv[x]=1,h[++cnth]=x,phv[x]=1;
 51         return;
 52     }
 53     for(ri i=31; i>=0; --i)
 54     {
 55         if(!tre[x][(num>>i)&1]) tre[x][(num>>i)&1]=++cnt,fa[cnt]=x;
 56         x=tre[x][(num>>i)&1];
 57 //      printf("I %lld\n",x);
 58         if(32-i==mx)
 59         {
 60             if(typ) del[x]=1,d[++cntd]=x;
 61             else hv[x]=1,h[++cnth]=x,phv[x]=1;
 62             break;
 63         }
 64     }
 65 }
 66 void ins()
 67 {
 68     int len=strlen(tc+1),wei=0,p=2,num=0,mx=32;
 69     for(; wei<4;)
 70     {
 71         int x=0;
 72         while(p<=len&&isdigit(tc[p])) x=x*10+tc[p]-'0',++p;
 73         if(wei==0) num+=x<<24;
 74         else if(wei==1) num+=x<<16;
 75         else if(wei==2) num+=x<<8;
 76         else num+=x;
 77         // printf("X %lld\n",x);
 78         ++wei; ++p;
 79     }
 80     if(p<=len)
 81     {
 82         // cout<<"A";
 83         int x=0;
 84         while(p<=len&&isdigit(tc[p])) x=x*10+tc[p]-'0',++p;
 85         mx=x;
 86     }
 87     // cout<<bitset<32>(num);
 88     // printf("S %lld %lld\n",mx,(int)(tc[1]=='-'));
 89     inser(num,mx,tc[1]=='-');
 90 }
 91 void gun()
 92 {
 93     puts("-1");
 94     exit(0);
 95 }
 96 vector<string>ans;
 97 const int bit=(1<<8)-1;
 98 void toans(int num,int mx)
 99 {
100     num<<=32-mx;
101     // cout<<bitset<32>(num)<<"D"<<endl;
102     stringstream str;
103     for(ri wei=0; wei<4; ++wei)
104     {
105         int x=(num&(bit<<((4-wei-1)*8)))>>((4-wei-1)*8);
106         str<<x;
107         if(wei<3) str<<".";
108         else str<<"/";
109     }
110     str<<mx;
111     string res;
112     str>>res;
113     ans.pb(res);
114 }
115 void dfs(int x,int num,int dep)
116 {
117     if(!x) return;
118 //  cout<<bitset<32>(num);
119 //  printf(" %lld %lld\n",(int)hv[x],(int)del[x]);
120     if(del[x])
121     {
122 //      cout<<"BBBBBBBB";
123         toans(num,dep);
124         return;
125     }
126     dfs(tre[x][0],num<<1,dep+1);
127 //  cout<<"A";
128     dfs(tre[x][1],num<<1|1,dep+1);
129 }
130 signed main()
131 {
132 #ifdef M207
133     freopen("in.in","r",stdin);
134 #endif
135     in(n);
136     for(ri i=1; i<=n; ++i)
137     {
138         scanf("%s",tc+1);
139         ins();
140     }
141     sort(d+1,d+1+cntd);
142     cntd=unique(d+1,d+1+cntd)-d-1;
143     sort(h+1,h+1+cnth);
144     cnth=unique(h+1,h+1+cnth)-h-1;
145     for(ri i=1; i<=cnth; ++i)
146     {
147         int x=h[i];
148         while(x)
149         {
150             if(del[x]) gun();
151             hv[x]=1;
152             x=fa[x];
153 //          if(hv[x]) break;
154         }
155     }
156     for(ri i=1; i<=cntd; ++i)
157     {
158         int x=d[i];
159         while(x)
160         {
161             if(phv[x]) gun();
162             if(hv[x]) break;
163             del[x]=1;
164             x=fa[x];
165         }
166     }
167     dfs(1,0,0);
168     printf("%lld\n",(int)ans.size());
169     for(ri i=0; i<(int)ans.size(); ++i) cout<<ans[i]<<'\n';
170     return 0;
171 }

View Code

C.Cloud Computing

建立一棵权值线段树,将区间依次加入/删除,每次二分出最优解即可

这题也是i207M的,比赛的时候这题被切出来之后咕了好长时间才写完233(别着急我的水题在后面)

↓我补的代码

 1 #include<cstdio>
 2 #include<vector>
 3 #include<cstring>
 4 #include<algorithm>
 5 using namespace std;
 6 const int N=200005,M=1e6+6;
 7 struct a{long long cnt,pri;};
 8 vector<a> lv[M],rv[M];
 9 long long n,k,m,len,ans;
10 long long num[4*N],val[4*N];
11 long long ll[N],rr[N],cc[N],pp[N],uni[N];
12 void add(int nde,int l,int r,int pos,int task)
13 {
14     if(l==r)
15         num[nde]+=task,val[nde]=num[nde]*uni[l];
16     else
17     {
18         int mid=(l+r)/2,ls=2*nde,rs=2*nde+1;
19         (pos<=mid)?add(ls,l,mid,pos,task):add(rs,mid+1,r,pos,task);
20         num[nde]=num[ls]+num[rs],val[nde]=val[ls]+val[rs];
21     }
22 }
23 long long query(int nde,int l,int r,long long task)
24 {
25     if(!num[nde]) return 0;
26     if(l==r) return min(task,num[nde])*uni[l];
27     int mid=(l+r)/2,ls=2*nde,rs=2*nde+1;
28     if(num[ls]>=task) return query(ls,l,mid,task);
29     else return val[ls]+query(rs,mid+1,r,task-num[ls]);
30 }
31 int main()
32 {
33     scanf("%lld%lld%lld",&n,&k,&m);
34     for(int i=1;i<=m;i++)
35         scanf("%lld%lld%lld%lld",&ll[i],&rr[i],&cc[i],&pp[i]),uni[i]=pp[i];
36     sort(uni+1,uni+1+m); len=unique(uni+1,uni+1+m)-uni-1;
37     for(int i=1;i<=m;i++)
38     {
39         pp[i]=lower_bound(uni+1,uni+1+len,pp[i])-uni;
40         lv[ll[i]].push_back((a){cc[i],pp[i]});
41         rv[rr[i]].push_back((a){cc[i],pp[i]});
42     }
43     for(int i=1;i<=n;i++)
44     {
45         for(int j=0;j<(int)lv[i].size();j++)
46             add(1,1,len,lv[i][j].pri,lv[i][j].cnt);
47         ans+=query(1,1,len,k);
48         for(int j=0;j<(int)rv[i].size();j++)
49             add(1,1,len,rv[i][j].pri,-rv[i][j].cnt);
50     }
51     printf("%lld",ans);
52     return 0;
53 }

View Code

D.Garbage Disposal

按题意模拟,每天看看昨天剩下的,然后再看看今天的,最后搞不掉的剩到明天=。=(我保证马上就是我的题了QAQ

这题没补......

 1 #include<iostream>
 2 #include<cstdio>
 3 #include<cstdlib>
 4 #include<algorithm>
 5 #include<vector>
 6 #include<string>
 7 #include<cstring>
 8 #include<queue>
 9 #include<set>
10 #include<map>
11 #include<bitset>
12 #include<cmath>
13 #include<stack>
14 using namespace std;
15 #define ri register int
16 #define LL long long
17 #define il inline
18 #define mp make_pair
19 #define pb push_back
20 #define pairint pair<int,int>
21 #define fi first
22 #define se second
23 #define gc getchar
24 template<class T>il void in(T &x)
25 {
26     x=0; bool f=0; char c=gc();
27     while(c<'0'||c>'9')
28     {
29         if(c=='-') f=1;
30         c=gc();
31     }
32     while(c>='0'&&c<='9') x=x*10+(c^'0'),c=gc();
33     if(f) x=-x;
34 }
35 #undef gc
36 #define N 200005
37 #define int LL
38 int a[N];
39 int b[N];
40 int n,k;
41 int ans;
42 signed main()
43 {
44 #ifdef M207
45     freopen("in.in","r",stdin);
46 #endif
47     in(n); in(k);
48     for(ri i=1; i<=n; ++i)
49     {
50         in(a[i]);
51         int t=(a[i]+b[i])/k;
52         // printf("U %lld %lld\n",a[i],b[i]);
53         if(t*k>=b[i])
54         {
55             ans+=t;
56             t*=k;
57             t-=b[i];
58             b[i]=0;
59             // printf("T %lld %lld %lld\n",i,t,a[i]);
60             a[i]-=t;
61             b[i+1]+=a[i];
62         }
63         else
64         {
65             t=(b[i]+k-1)/k;
66             ans+=t;
67             // printf("Q %lld %lld\n",i,t);
68             t*=k;
69             t-=b[i];
70             a[i]-=t;
71             a[i]=max(a[i],0ll);
72             b[i+1]+=a[i];
73         }
74     }
75     ans+=(b[n+1]+k-1)/k;
76     printf("%lld",ans);
77     return 0;
78 }

View Code

E.Getting Deals Done

终于到了蒟蒻的水题辣

发现这个阈值好像并不好二分(也许是可以的?),但是又发现完成的数量越多阈值肯定是越小,因为这题里难度=完成时间,这是有单调性的,可以二分!

二分后如何检查?我们先不考虑时间限制,只是考虑做完这些任务,发现将任务排序后第$mid$个就是我们要的阈值!那么就按题意模拟然后看看是否超时即可,注意做够$mid$个任务我们就不用做了,还有d是正整数=。=......还有就是注意细节啊

所以你就把数组开小又没开long long贡献了一个WA+一个RE?

 1 #include<queue>
 2 #include<cstdio>
 3 #include<cstring>
 4 #include<algorithm>
 5 using namespace std;
 6 const int N=200005;
 7 long long a[N],b[N];
 8 long long T,n,m,t,l,r,ans;
 9 bool check(long long x,long long md)
10 {
11     long long tm=0,noww=0,cnt=0,tot=0;
12     for(int i=1;i<=n;i++)
13         if(b[i]<=x)
14         {
15             tot++,cnt++,tm+=b[i],noww+=b[i];
16             if(tot>=md) return tm<=t;
17             if(cnt==m) cnt=0,tm+=noww,noww=0;
18         }
19     return tm<=t;
20 }
21 int main ()
22 {
23     scanf("%lld",&T);
24     while(T--)
25     {
26         scanf("%lld%lld%lld",&n,&m,&t),a[0]=1;
27         for(int i=1;i<=n;i++)
28             scanf("%lld",&b[i]),a[i]=b[i];
29         sort(a+1,a+1+n),l=0,r=n;
30         while(l<=r)
31         {
32             int mid=(l+r)/2,td=a[mid];
33             if(check(td,mid)) ans=mid,l=mid+1;
34             else r=mid-1;
35         }
36         printf("%lld %lld\n",ans,a[ans]);
37     }
38     return 0;
39 }

View Code

F.Debate

个人比较喜欢的贪心题,就把这个题切掉辣

首先先把两个人都支持的全选了,这样答案只会越来越合法;然后我们从只支持一个人的两堆人里的前$siz$大的人都选了,其中$siz$是两堆人中较小的那堆人的数量,这样答案一定还是合法的;最后把剩下的丢进大根堆选到不能选为止......

注意像我这样最后把多选的那个不合法的人丢掉的话要判断是不是选完了都是合法的你就不能换个不这么毒瘤的写法吗,又贡献了一个WA=。=

 1 #include<queue>
 2 #include<cstdio>
 3 #include<cstring>
 4 #include<algorithm>
 5 using namespace std;
 6 const int N=400005;
 7 long long typ[4],ali[N],bob[N],non[N],all[N];
 8 struct a
 9 {
10     long long v,t;
11 };
12 bool operator < (a x,a y)
13 {
14     return x.v<y.v;
15 }
16 priority_queue<a> hp1; char ss[4];
17 long long n,rd,c1,c2,c3,c4,cc1,cc2,peo,ans,b1,b2,mem;
18 int gkind(char *s)
19 {
20     if(s[0]==s[1]&&s[0]=='0') return 0;
21     if(s[0]==s[1]&&s[0]=='1') return 3;
22     if(s[0]=='0') return 1;
23     else return 2;
24 }
25 bool cmp(long long a,long long b)
26 {
27     return a>b;
28 }
29 int main ()
30 {
31     scanf("%lld",&n);
32     for(int i=1;i<=n;i++)
33     {
34         scanf("%s%lld",ss,&rd);
35         b1|=(ss[0]-'0'),b2|=(ss[1]-'0');
36         int tmp=gkind(ss); typ[tmp]++;
37         if(tmp==2) ali[++c1]=rd;
38         else if(tmp==1) bob[++c2]=rd;
39         else if(tmp==3) ans+=rd,cc1++,cc2++,peo++;
40         else non[++c4]=rd;
41     }
42     if(!b1||!b2) printf("0"),exit(0);
43     int siz=min(c1,c2);
44     sort(ali+1,ali+1+c1,cmp);
45     sort(bob+1,bob+1+c2,cmp);
46     for(int i=1;i<=siz;i++)
47         ans+=ali[i]+bob[i],cc1++,cc2++,peo+=2;
48     if(siz==c1)
49         for(int i=siz+1;i<=c2;i++) hp1.push((a){bob[i],2});
50     else
51         for(int i=siz+1;i<=c1;i++) hp1.push((a){ali[i],1});
52     for(int i=1;i<=c4;i++) hp1.push((a){non[i],3});
53     while(!hp1.empty()&&cc1>=(peo+1)/2&&cc2>=(peo+1)/2)
54     {
55         a tp=hp1.top(); hp1.pop();
56         ans+=tp.v,mem=tp.v;
57         if(tp.t==1) cc1++,peo++;
58         else if(tp.t==2) cc2++,peo++;
59         else peo++;
60     }
61     if(cc1<(peo+1)/2||cc2<(peo+1)/2) ans-=mem;
62     printf("%lld",ans);
63     return 0;
64 }

View Code

G.Monsters and Potions

比赛的时候我俩都觉得这题讨论太多了然后就弃掉了,其实下来分析完是个模拟题2333

枚举位置从两边向中间按题意模拟,贪心让血量最高的英雄来打怪/吃药

↓补的代码

 1 #include<cstdio>
 2 #include<cstring>
 3 #include<algorithm>
 4 using namespace std;
 5 const int N=110,inf=2e9;
 6 int n,m,rd,flag,mini,maxx;
 7 int num[N],hel[N],val[N],outp[N],mark[N];
 8 bool able(int pos)
 9 {
10     int noww=0,pts=0,ok=0;
11     for(int i=maxx;i>pos;i--)
12     {
13         if(noww<hel[num[i]])
14             outp[++pts]=num[i],noww=hel[num[i]];
15         noww+=val[i]; if(noww<0) return false;
16     }
17     ok|=(noww+val[pos]>=0),noww=0;
18     for(int i=mini;i<pos;i++)
19     {
20         if(noww<hel[num[i]])
21             outp[++pts]=num[i],noww=hel[num[i]];
22         noww+=val[i]; if(noww<0) return false;
23     }
24     ok|=(noww+val[pos]>=0);
25     if(!ok) return false; printf("%d\n",pos);
26     while(pts)
27         printf("%d ",outp[pts]),mark[outp[pts--]]=true;
28     for(int i=1;i<=m;i++) if(!mark[i]) printf("%d ",i);
29     return true;
30 }
31 int main ()
32 {
33     scanf("%d%d",&n,&m);
34     hel[0]=-inf,mini=inf,maxx=-inf;
35     for(int i=1;i<=m;i++)
36     {
37         scanf("%d%d",&rd,&hel[i]),num[rd]=i;
38         mini=min(mini,rd),maxx=max(maxx,rd);
39     }
40     for(int i=1;i<=n;i++)
41         scanf("%d",&val[i]);
42     for(int i=1;i<=n;i++)
43         if(able(i)) return 0;
44     printf("-1");
45     return 0;
46 }

View Code

H.BerOS File Suggestion

我一开始以为是AC自动机,然后因为我不会AC自动机就给i207M了。结果最后发现串长太小了,在Trie上打标记,对每个串暴力跑就行了......

这题也咕了......

update on 2018.10.23:

昨天才说咕掉算了,结果今天考试就考了个弱化版,那就把考试的代码随便改改放上来算了=。=

 1 #include<cstdio>
 2 #include<cctype>
 3 #include<cstring>
 4 #include<algorithm>
 5 using namespace std;
 6 const int N=10005;
 7 char rd[10],str[N*28][10];
 8 int n,m,tot,len,nde,ans,flag;
 9 int cnt[N*28],mark[N*28],trie[N*28][37];
10 int turn(char ch)
11 {
12     if(isdigit(ch)) return ch-'0';
13     else if(ch>='a'&&ch<='z')
14         return ch-'a'+10;
15     else return 36;
16 }
17 int main()
18 {
19     register int i,j,k,h;
20     scanf("%d",&n);
21     for(i=1;i<=n;i++)
22     {
23         scanf("%s",rd+1);
24         len=strlen(rd+1);
25         for(j=len;j;j--)
26         {
27             nde=0;
28             for(k=j;k<=len;k++)
29             {
30                 int ch=turn(rd[k]);
31                 if(!trie[nde][ch])
32                     trie[nde][ch]=++tot;
33                 nde=trie[nde][ch];
34                 if(mark[nde]!=i)
35                 {
36                     cnt[nde]++,mark[nde]=i;
37                     memset(str[nde],0,sizeof str[nde]);
38                     for(h=1;h<=len;h++) str[nde][h]=rd[h];
39                 }
40             }
41         }
42     }
43     scanf("%d",&m);
44     for(i=1;i<=m;i++)
45     {
46         scanf("%s",rd+1);
47         len=strlen(rd+1),flag=true,nde=0;
48         for(j=1;j<=len;j++)
49         {
50             int ch=turn(rd[j]);
51             if(!trie[nde][ch])
52                 {flag=0; break;}
53             nde=trie[nde][ch];
54         }
55         flag?printf("%d %s\n",cnt[nde],str[nde]+1):printf("0 -\n");
56     }
57     return 0;
58 }

View Code

I.Privatization of Roads in Berland

i207M太强了,比赛的时候居然看出来了是个网络流

这题咕了没啥可说的吧=。=

J.Streets and Avenues in Berhattan

我在最后时刻分析出了性质,结果走偏了,不知道怎么开始暴力讨论去了TAT

这个性质就是我们一定可以构造一个最优解使得重复的都是一种字母,否则这个解不可能优于最优解(建议自己写写画画

于是我们枚举哪种字母是最后重复的,对剩下的做01背包得出可行的重复长度,枚举一边的长度更新答案即可

注意在保证输入总量而不是数据组数的时候不要memset,手动赋值才是对的

↓这是我赛后补的代码

 1 #pragma GCC optimize(2)
 2 #include<cstdio>
 3 #include<cstring>
 4 #include<algorithm>
 5 using namespace std;
 6 const int N=200005;
 7 int T,n,m,k,len,ans;
 8 int cnt[30],dp[N];
 9 char rd[N];
10 bool cmp(int a,int b)
11 {
12     return a>b;
13 }
14 void init()
15 {
16     len=strlen(rd+1),ans=n*m;
17     memset(cnt,0,sizeof cnt);
18     for(int i=1;i<=len;i++)
19         cnt[rd[i]-'A'+1]++;
20 }
21 int main ()
22 {
23     register int i,j,h;
24     scanf("%d",&T);
25     while(T--)
26     {
27         scanf("%d%d%d",&n,&m,&k);
28         scanf("%s",rd+1),init();
29         for(i=1;i<=26;i++)
30         {
31             for(j=1;j<=k;j++) dp[j]=0; dp[0]=1;
32             for(j=1;j<=26;j++)
33                 if(j!=i)
34                     for(h=k;h>=cnt[j];h--)
35                         dp[h]|=dp[h-cnt[j]];
36             for(j=0;j<=k;j++)
37                 if(dp[j])
38                 {
39                     int xx=max(0,n-j),yy=max(0,m-(k-cnt[i]-j));
40                     if(xx+yy<=cnt[i]) ans=min(ans,xx*yy);
41                 }
42         }
43         printf("%d\n",ans);
44     }
45     return 0;
46 }

View Code

K.Video Posts

本来是个模拟水题,结果我少判了一种无解(有个特别大的数不能拆),贡献了一个制杖的罚时TAT

 1 #include<cstdio>
 2 #include<cstring>
 3 #include<algorithm>
 4 using namespace std;
 5 const int N=100005;
 6 long long n,k,sum,goal,noww,last;
 7 long long a[N],b[N],cnt;
 8 int main ()
 9 {
10     scanf("%lld%lld",&n,&k);
11     for(int i=1;i<=n;i++)
12         scanf("%lld",&a[i]),sum+=a[i];
13     if(sum%k) printf("No"),exit(0);
14     goal=sum/k;
15     for(int i=1;i<=n;i++)
16     {
17         noww+=a[i];
18         if(noww==goal)
19             b[++cnt]=i-last,noww=0,last=i;
20     }
21     if(cnt!=k) printf("No"),exit(0);
22     printf("Yes\n");
23     for(int i=1;i<=k;i++)
24         printf("%lld ",b[i]);
25     return 0;
26 }

View Code

L.Odd Federalization

大力讨论题,做不来,gal辞(雾

M.Algoland and Berland

全场只有一个AC的神仙题,摸了......

希望还能再和i207M一起打更多的比赛,可是我真的马上要退役了TAT

转载于:https://www.cnblogs.com/ydnhaha/p/9827348.html

2018.10.20 2018-2019 ICPC,NEERC,Southern Subregional Contest(Online Mirror, ACM-ICPC Rules)相关推荐

  1. 【*2000】【2018-2019 ICPC, NEERC, Southern Subregional Contest C 】Cloud Computing

    [链接] 我是链接,点我呀:) [题意] [题解] 我们可以很容易知道区间的每个位置有哪些安排可以用. 显然 我们优先用那些花费的钱比较少的租用cpu方案. 但一个方案可供租用的cpu有限. 我们可以 ...

  2. [CodeForces1070C]Cloud Computing(2018-2019 ICPC, NEERC, Southern Subregional Contest )

    传送门:戳我 在cf上做的镜像赛,结果不是很妙啊.. 这题是用时最长但并没有在比赛内写出来(事实上在赛后还话了大概五小时调试才找出错误) 首先不难发现我们需要一棵线段树,(其实一开始我考虑的是主席树) ...

  3. Codeforces 1070A Find a Number(BFS) 2018-2019 ICPC, NEERC, Southern Subregional Contest Problem A

    Description You are given two positive integers ddd and sss. Find minimal positive integer nnn which ...

  4. 2013-2014 ACM-ICPC, NEERC, Southern Subregional Contest Problem I. Plugs and Sockets 费用流

    Problem I. Plugs and Sockets 题目连接: http://www.codeforces.com/gym/100253 Description The Berland Regi ...

  5. 2017-2018 ACM-ICPC, NEERC, Southern Subregional Contest

    A. Automatic Door 对于规律的点可以推公式计算,对于噪点则暴力计算,时间复杂度$O(m\log m)$. #include<stdio.h> #include<ios ...

  6. 2013-2014 ACM-ICPC, NEERC, Southern Subregional Contest Problem C. Equivalent Cards 计算几何

    Problem C. Equivalent Cards 题目连接: http://www.codeforces.com/gym/100253 Description Jane is playing a ...

  7. 2013-2014 ACM-ICPC, NEERC, Southern Subregional Contest Problem D. Grumpy Cat 交互题

    Problem D. Grumpy Cat 题目连接: http://www.codeforces.com/gym/100253 Description This problem is a littl ...

  8. 【一周头条盘点】中国软件网(2018.8.20~2018.8.24)

    每一个企业级应用的人都置顶了中国软件网 中国软件网为你带来最新鲜的行业干货 趋势洞察 =========== 苗圩:未来5年是我国超高清视频产业发展的战略机遇期 工业和信息化部部长苗圩表示:超高清视频 ...

  9. 【一周头条盘点】中国软件网(2018.10.8~2018.10.12)

    每一个企业级应用的人都置顶了中国软件网 中国软件网为你带来最新鲜的行业干货 每周热点 ========= 华为首发沃土AI开发者使能计划 10月12日,在HUAWEI CONNECT 2018期间,面 ...

  10. c语言哥德巴赫数学猜想,哥德巴赫数学猜想“1+1”是怎么回事,你知道吗?丨2018/10/20...

    每天写一篇日记,雷打不动 2018年10月20日星期六,上午晴下午阴 [目  录]  何雷西奥日记 今天有点小确幸,在不经意中让我遇见了著名的哥德巴赫猜想. 然后,又让我搞明白了这个数学猜想的基本内容 ...

最新文章

  1. Java在开发中应注意的问题_Java设计编程应该注意的几个问题
  2. OpenCV iOS-视频处理
  3. 为什么 Dapper 的批量插入比我预期的要慢很多?
  4. Oracle入门(二)之服务启动bat
  5. sprintboot 配置文件上传大小(默认是1MB)
  6. 蚂蚁Service Mesh大规模落地实践与展望
  7. win系统流畅度测试软件,视频对比:老电脑装Win7、Win10流畅性测试
  8. 全文检索工具包Lucene
  9. Linux7没有网卡,centos7安装后缺少网卡如何解决?
  10. 时间序列经济python_(13)Python初入坑之时间序列基础内容
  11. 互联网+餐饮:看李帅与面点王董事长张和平如何说
  12. 计算机专业考研410分,从一个中专生到考研410分的历程
  13. CSDN 技术问答升级规则
  14. 基于云计算的毕业设计题目
  15. html5 打气球小游戏,javascript开发打气球小游戏
  16. MATLAB基于Randon变换的图像倾斜校正算法及实现
  17. 如何将某一文件添加到信任列表?
  18. ISTQB基础级考试资料汇总
  19. 树莓派4BUbuntu server 20.04 Kubernetes-v1.17.x- Docker19.03 keadmv1.10.3部署错误一览
  20. FIDE 全新编译体验,编译速度大幅提升

热门文章

  1. Leetcode-213:打家劫舍 II
  2. python伪装浏览器https_Python3 伪装浏览器的方法示例
  3. 蓝牙学习笔记(九)——BLE超过20字节数据包传输(MTU)
  4. 基于Zephyr在微型MCU上使用Tensor Flow Lite Micro做图像分类
  5. win10无法访问服务器上的共享文件夹怎么设置,提示:你不能访问此共享文件夹,因为你组织的安全策略阻止未经身份验证的来宾访问...
  6. [项目过程中所遇到的各种问题记录]编辑器篇——使用FCKeditor生成静态分页HTML...
  7. mysql配置utf8_mb4
  8. RecyclerView 下拉刷新和加载更多
  9. mac上启用tftp服务器
  10. openindiana软件包维护