We will hold AtCoder Regular Contest 186. Contest URL:https://atcoder.jp/contests/arc186 Start Time:http://www.timeanddate.com/worldclock/fixedtime.html?iso=20241027T2100&p1=248 Duration: 120 minutes Number of Tasks: 5 Writer:nuip Tester:maroonrk Rated range: 1200 ~ 2799 The point value...
#include<vector>#include<iostream>#include<algorithm>usingi64 =longlong;usingvint = std::vector<int>;usingPII = std::pair<int,int>;intmain(void){//Think twice, code once.std::ios::sync_with_stdio(false); i64 a[3]; std::cin >> a[0] >> a[1] >> a[2]; i64 x = a[0] ...
LL pre[N], suf[N], b[N]; voidsolve(){ cin >> n; for(inti =1; i <= n; i++) { cin >> a[i]; b[i] = a[i]; l[i] = i -1; r[i] = i +1; pre[i] = pre[i -1] + a[i]; } for(inti = n; i >=1; i--) { suf[i] = suf[i +1] + a[i]; } w...
枚举左下角矩形从哪个位置进入,组合计数一下就好了。 1#include<bits/stdc++.h>2#defineN (200009)3#defineLL long long4#defineMOD (1000000007)5usingnamespacestd;67LL inv[N],fac[N],facinv[N];8LL h,w,a,b;910voidInit()11{12fac[0]=facinv[0]=inv[1]=1;13for(inti=1; i<=200000; ...
优化一:如果当前(l_i,r_i)中l_i> x,则对于所有r_j<= x 都连边,所以可以排序+二分建边,同理如果当前(l_i,r_i)中r_i< x,则对于所有l_j>= x 都连边,因此可以l和r分别建边,建边时间复杂度降低为nlogn 优化二:离线操作,对于相同的s,只询问一次,把问题存起来排序,然后把答案ans数组里 ...
#include<bits/stdc++.h> using namespace std; const int N=3e5+10; int n, k; int a[N], b[N]; char s[N]; int main() { int t; scanf("%d", &t); while(t--) { int ans=0, L=0, R=0; scanf("%d%d", &n, &k); cin>>s+1; s[n+1]='0', s[0]='0'; for(in...
AtCoder Regular Contest 121 (AB题解) 二维坐标图中有\(n\)个房子,现在规定两房子距离定义为:\(max(|x_i−x_j|,|y_i−y_j|)\) 求第二大的距离值 【解法一】对\(x,y\)进行排序寻找 #define f first #define s second const int N = 2e5 + 10;...
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 ...
164 -- 1:43:11 App [6/8] AtCoder Beginner Contest 286 (unrated) 181 -- 27:25 App [6/6] VP AtCoder Beginner Contest 166 (随机 VP) 441 1 2:00:59 App [5/7] Educational Codeforces Round 142 (1660 ⭜ 1889) 468 -- 42:43 App AtCoder Beginner Contest 334 A 至 G 題...
A - Bridge and Sheets 直接计算就好了。具体而言,使用一个变量记录前面一个木板右端点是哪里,然后在看当前木板的时候,如果中间有空隙就加上,然后接着维护下去就行了。 intN;longlongW,L;intmain(){cin>>N>>L>>W;longlongr=0;longlongans=0;longlonga;for(inti=1;i<=N;i++){cin>>a;if(a>r)...