牛客
龍木
若人生为棋,我愿为卒,漫漫征途,谁曾见我后退半步
展开
-
I Box
Box 链接:https://ac.nowcoder.com/acm/contest/7854/I 来源:牛客网 Bella is working in a factory that produces boxes. All boxes are in a shape of rectangular parallelepipeds. A net of the corresponding parallelepiped is cut out of a flat rectangular piece of car.原创 2020-10-07 13:02:10 · 444 阅读 · 1 评论 -
C 交换游戏
链接:https://ac.nowcoder.com/acm/contest/4462/C 一列上有12个孔,这12个孔中有些孔被遮挡住了。 假定我们用 '-' 来表示没被遮挡住的孔,用 'o' 来表示被遮挡住的孔。 如果相邻的三个孔有两个孔被遮挡,并且被遮挡的两个孔相邻,就是 '-oo' 和 'oo-'。 对于这样的三个孔,我们可以将中间的孔的遮挡物移开,代价是将一端的遮挡物移到另一端没...原创 2020-02-23 13:34:33 · 17197 阅读 · 5 评论 -
B 小y的序列
链接:https://ac.nowcoder.com/acm/contest/7780/B 来源:牛客网 又是一年 CSP,机房的oier都在刷题,alan却在发呆想着小y,正巧忽然听到隔壁机房某神zlk熟悉的声音:“找规律就可以了吧,这个序列感觉很熟悉啊,就是1,2,4,6,11这其实就是一个a[i+1]-a[i]=i的序列哦,突然隔壁的声音大了起来,zlk,你好像有个数写错了(大雾)~ 课后,alan在纸上写下了这个题目,让szm做:给一个长度为n的序列a,你希望改最少的数,使得这个序列满足a[i.原创 2020-10-05 11:55:59 · 274 阅读 · 0 评论 -
2020牛客多校第十场
A.Permutation 暴力 #include<bits/stdc++.h> using namespace std; #define ll long long #define sc(a) scanf("%d",&a) #define pf printf #define pb push_back const int N=1e6+10; int n; int a[N],vis[N]; int main() { int t;sc(t); while(t--) { sc(原创 2020-09-13 16:29:03 · 117 阅读 · 0 评论 -
2020牛客多校第九场
A.Groundhog and 2-Power Representation 构造 #include<bits/stdc++.h> using namespace std; typedef unsigned long long ll; const int mod=998244353; const int maxn=2e4+10; char a[maxn]; int b[maxn],n,mmax; int f(int l,int r) { int s=0,m,sum=0; for(in原创 2020-09-13 16:25:23 · 87 阅读 · 0 评论 -
2020牛客多校第八场
I.Interesting Computer Game 并查集 #include<bits/stdc++.h> using namespace std; typedef unsigned long long ll; const int mod=1e9+7; const int maxn=1e5+10; int a[2*maxn],f[2*maxn],s[2*maxn],m[2*maxn]; struct cc{ int x,id; }p[2*maxn]; bool cmp(cc x,cc原创 2020-09-13 16:20:58 · 97 阅读 · 1 评论 -
2020牛客多校第七场
B.Mask Allocation 队友签的到 #include<bits/stdc++.h> using namespace std; #define ll long long #define sc(a) scanf("%d",&a) #define pf printf #define pi acos(-1) #define pb push_back const int mod=1e9+7; const int N=1e6+10; int n,m; int ans; void d原创 2020-09-13 15:50:47 · 86 阅读 · 0 评论 -
2020牛客多校第一场
F.Infinite String Comparision 签到 #include<bits/stdc++.h> using namespace std; #define ll long long #define pi acos(-1) #define sc(a) scanf("%d",&a) #define pf printf #define vi vector<int> const int N=1e5+10; const int mod=1e9+7; int n,m原创 2020-09-13 15:46:55 · 109 阅读 · 0 评论 -
2020牛客多校第六场
B.Binary Vector 看样例,求逆元异或前缀和 #include<bits/stdc++.h> using namespace std; typedef unsigned long long ll; const int mod=1e9+7; const int maxn=2e7+10; ll ksm(ll x) { ll ans=1,n=mod-2; while(n) { if(n%2==1) ans*=x,ans%原创 2020-07-27 18:45:17 · 429 阅读 · 0 评论 -
2020牛客多校第五场
D.Drop Voicing 最后队友猜了一发结论是最长上升子序列,过了。。。 #include<bits/stdc++.h> using namespace std; typedef unsigned long long ll; #define sc(a) scanf("%d",&a) const int mod=1e9+9; const int N=501; int n,a[N],dp[N],s[N]; int ans=1e9; int main() { sc(n);原创 2020-07-26 13:43:50 · 407 阅读 · 0 评论 -
2020牛客多校第四场
B.Basic Gcd Problem www我的锅,一直以为1返回的是c没有特判,直到队友问了才发现QAQ 就是简单的快数幂 代码: #include<bits/stdc++.h> using namespace std; #define ll long long #define pi acos(-1) const int maxn=1e6+10; const int mod=1e9+7; ll ksm(ll x,int n) { ll ans=1; while(n)原创 2020-07-21 09:27:55 · 186 阅读 · 0 评论 -
2020牛客多校第三场
A.Clam and Fish 贪心,有鱼一定钓鱼,没有看后面的无鱼地有多少,可以用前缀和处理出来,比较一下就行了 代码: #include<bits/stdc++.h> using namespace std; #define ll long long #define pi acos(-1) const int maxn=2e6+10; const int mod=1e9+7; int n; char a[maxn]; int s[maxn]; int main() { int原创 2020-07-19 11:15:21 · 268 阅读 · 0 评论 -
2020牛客多校第二场
B.Boundary 题解:n^2求出x、y以及原点三点的外接圆心,找到圆心数量最多的maxn,求maxn=(x-1)*x,解出方程即可,主要是要特判三点共线的情况以及精度问题 代码: #include<bits/stdc++.h> using namespace std; #define ll long long #define pi acos(-1) const int maxn=2e6+10; const int mod=1e9+7; const double eps=1e-12;原创 2020-07-14 13:44:56 · 248 阅读 · 1 评论 -
A Equivalent Prefixes
链接:https://ac.nowcoder.com/acm/contest/6362/A Two arrays u and v each with m distinct elements are called equivalent if and only if RMQ(u,l,r)=RMQ(v,l,r)\mathrm{RMQ}(u, l, r) = \mathrm{RMQ}(v, l, r)RMQ(u,l,r)=RMQ(v,l,r) for all 1≤l≤r≤m1 \leq l \leq r \leq原创 2020-07-11 17:40:50 · 182 阅读 · 0 评论