Codeforces Round #600 (Div. 2) A. Single Push
#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
int T,n;
int a[],b[];
int main() {
scanf("%d",&T);
while(T--) {
scanf("%d",&n);
for(int i=; i<=n; i++)scanf("%d",&a[i]);
for(int i=; i<=n; i++)scanf("%d",&b[i]);
int fl=,t,fl2=,j;
for(int i=; i<=n; i++) {
if(a[i]^b[i]) {
t=b[i]-a[i];
if(t<=) {
fl=;
break;
}
for(j=i+; j<=n; j++) {
if(b[j]==a[j])break;
if(b[j]-a[j]!=t) {
fl2=;
break;
}
}
if(!fl2) {
for(j; j<=n; j++)if(a[j]!=b[j]) {
fl=;
break;
}
} else fl=;
break;
}
}
printf(fl?"NO\n":"YES\n"); }
return ;
}
Codeforces Round #600 (Div. 2) A. Single Push的更多相关文章
- 【cf比赛记录】Codeforces Round #600 (Div. 2)
Codeforces Round #600 (Div. 2) ---- 比赛传送门 昨晚成绩还好,AC A,B题,还能上分(到底有多菜) 补了C.D题,因为昨晚对C.D题已经有想法了,所以补起题来也快 ...
- Codeforces Round #600 (Div. 2) E. Antenna Coverage
Codeforces Round #600 (Div. 2) E. Antenna Coverage(dp) 题目链接 题意: m个Antenna,每个Antenna的位置是\(x_i\),分数是\( ...
- Codeforces Round #600 (Div. 2)
传送门 A. Single Push 直接乱搞即可. Code /* * Author: heyuhhh * Created Time: 2019/11/16 22:36:20 */ #include ...
- Codeforces Round #600 (Div. 2)E F
题:https://codeforces.com/contest/1253/problem/E 题意:给定n个信号源,俩个参数x和s,x代表这个信号源的位置,s代表这个信号源的波及长度,即这个信号源可 ...
- Codeforces Round #600 (Div. 2) D题【并查集+思维】
题意:给你n个点,m条边,然后让你使得这个这个图成为一个协和图,需要加几条边.协和图就是,如果两个点之间有一条边,那么左端点与这之间任意一个点之间都要有条边. 思路:通过并查集不断维护连通量的最大编号 ...
- Codeforces Round #600 (Div. 2) D。 Harmonious Graph
#include<iostream> using namespace std ; ; int p[N]; int cnt; int find(int x) { if(p[x]!=x) p[ ...
- Codeforces Round #600 (Div. 2) C - Sweets Eating
#include<iostream> #include<algorithm> #include<cstring> using namespace std ; typ ...
- Codeforces Round #600 (Div. 2) B. Silly Mistake
#include<iostream> #include<map> #include<set> #include<algorithm> using nam ...
- Codeforces Round #600 (Div. 2) - D. Harmonious Graph(并查集)
题意:对于一张图,如果$a$与$b$连通,则对于任意的$c(a<c<b)$都有$a$与$c$连通,则称该图为和谐图,现在给你一张图,问你最少添加多少条边使图变为和谐图. 思路:将一个连通块 ...
随机推荐
- OHEM论文笔记
目录 引言 Fast R-CNN设计思路 一.动机 二.现有方案hard negative mining 及其窘境 hard negative mining实现 窘境 设计思路 OHEM步骤: 反向传 ...
- setter&getter
let _age = 4 class Animal { construct (type){ this.type = type } get age(){ return _age } set age(va ...
- IE浏览器中IFrame被加载两次问题的解决-sunziren
本文为作者sunziren原创,首发博客园,转载请注明出处. 昨天遇到了一个问题,先上代码. var content = '<iframe src="www.baidu.com&quo ...
- 剑指offer-面试题32-之字形打印二叉树-二叉树栈
/* 题目: 分行按层自上向下呈之字形打印二叉树.第一行从左到右,第二行从右到左,第三行从左到右... */ /* 思路: 使用两个栈stack1和stack2. stack1存储从左向右打印的节点, ...
- 进程无法连接到 Subscriber"XXXXXXX"
进程无法连接到 Subscriber“APP07”. 在订阅的机器上config 添加别名 APP07
- sqlserver with 递归用法
DECLARE @companyid TABLE ( [Id] [int] ); with cte as( union all select a.Id from [base].[Company] a, ...
- 项目在UAP可以直接启动,但是在eclipse上面不能直接启动
上面两个eclipse都是用友的开发人员给我的,左边是驻场开发给我的,但是没有教我怎么用和哪里好用,所以一直用UAP来做开发.右边的eclipse是提ISM问题,北京用友远程调试问题时给我的,而且终于 ...
- python list comprehensions
list comprehensions 列表解释 You now have all the knowledge necessary to begin writing list comprehensio ...
- EF Code-First(Oracle)通过Migration来更新数据库的表的字段
关于Oracle中使用Entity Framework 6.x Code-First方式开发,请参考博客(菩提树下的杨过)https://www.cnblogs.com/yjmyzz/p/how-to ...
- ASP.NET MVC中ActionResult的不同返回方式
1.返回视图 return View();//返回方法名对应的视图 return View("aaa");//返回名称为aaa的视图 2.返回文本内容 return Content ...