E:用二进制表示放的数字,然后状压$DP$。 F:$biset$优化$DP$预处理,乱搞贪心。 ARC 059 D:傻题,存在长的合法子串就一定会存在短的。 E:前缀和优化$DP$。 F:每个长度为$len$的串出现的概率是相同的,求到长度为$len$的方案数然后除$2^{len}$。 ARC 060 D:对$b$分大于根号和小于根号讨论。 E:倍增...
...,Sn tomorrow. He is excited and already thinking of what string he will create. Since he does not know the string on the headline yet, he is interested in strings that can be created regardless of which string the headline contains....
在实现上可以取出正数的前三大、前三小与负数的前三大和前三小(这里有一种感性的理解,即原式的值取决于数的绝对值大小和数的符号,所以可以这么取),然后直接暴力枚举更新答案即可 #include<bits/stdc++.h>usingnamespacestd;voidsolve(){intn;cin>>n;vector<int>a,b;for(inti=0;i<n;i++){intx;cin>>...
情况一:有直连边 答案是 w[s] + w[t] 不存在更优解 情况二:需要借助第三个边 此时答案为w[s] + w[t] + min{ min(l_s,l_t)左边最小的w(r边),max(r_s,r_t)右边最小的w(l边) } 情况三 : 需要借助2个边(需要排除s t的包含关系,证明显然) 此时答案为w[s] + w[t] + min{ max(...
AtCoder Regular Contest 127 F ±AB 洛谷传送门 AtCoder 传送门 非常妙的题。 先直观感受一下,显然当MM大到一定程度后,[0,M][0,M]的所有数都能被取到。考虑V←V+Ax+ByV←V+Ax+By,其中V+Ax+By∈[0,M]V+Ax+By∈[0,M]。如果x,yx,y都是正数显然可以取到。如果一正一负,比如x>0,y≤0x>0,...
观察性质暴力 #include<bits/stdc++.h> usingnamespacestd; #definepb push_back #defineendl'\n' #defineLL long long constintN =5e5+10; intn, a[N], l[N], r[N]; LL pre[N], suf[N], b[N]; voidsolve(){ cin >> n; for(inti =1; i <= n; i++) { ...
We will hold AtCoder Regular Contest 155. Contest URL: https://atcoder.jp/contests/arc155 Start Time: http://www.timeanddate.com/worldclock/fixedtime.html?iso=20230129T2100&p1=248 Duration: 120 minutes Number of Tasks: 6 Writer: chinerist Tester: tatyam, satashun Rated range: — 2799...
AtCoder Regular ContestAtCoder Grand ContestContestA ProblemB ProblemC Problem AGC038 A - 01 Matrix Python ARC Like ContestContestA ProblemB ProblemC ProblemD ProblemE ProblemF Problem DISCO presents ディスカバリーチャンネル コードコンテスト2020 予選 B - Iron Bar CuttingPython ABC Like Con...
前面四道题都比较简单,后面两道题的题面到现在都没有加载出来。 A - Bridge and Sheets 直接计算就好了。具体而言,使用一个变量记录前面一个木板右端点是哪里,然后在看当前木板的时候,如果中间有空隙就加上,然后接着维护下去就行了。 intN;longlongW,L;intmain(){cin>>N>>L>>W;longlongr=0;longlongans...
We will hold AtCoder Regular Contest 151. Contest URL:https://atcoder.jp/contests/arc151 Start Time:http://www.timeanddate.com/worldclock/fixedtime.html?iso=20221016T2100&p1=248 Duration: 120 minutes Number of Tasks: 6 Writer:leaf1415 ...