https://codeforces.com/contest/1155/problem/C

题解:

1、对x数组求差;

2、对x数组差求GCD;

3、暴力查找p数组有没有GCD%pi==0;

/*
*@Author:   STZG
*@Language: C++
*/
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
#include<list>
#include<map>
#include<set>
//#define DEBUG
#define RI register int
#define endl "\n"
using namespace std;
typedef long long ll;
//typedef __int128 lll;
const int N=300000+10;
const int M=100000+10;
const int MOD=1e9+7;
const double PI = acos(-1.0);
const double EXP = 1E-8;
const int INF = 0x3f3f3f3f;
int t,n,m,k,p,l,r,u,v;
ll ans,cnt,flag,temp,sum;
ll a[N],b[N],c[N];
char str;
struct node{};
int main()
{
#ifdef DEBUGfreopen("input.in", "r", stdin);//freopen("output.out", "w", stdout);
#endif//ios::sync_with_stdio(false);//cin.tie(0);//cout.tie(0);//scanf("%d",&t);//while(t--){scanf("%d%d",&n,&m);for(int i=1;i<=n;i++){scanf("%I64d",&a[i]);}for(int i=1;i<=m;i++){scanf("%I64d",&b[i]);}for(int i=1;i<n;i++){c[i]=a[i+1]-a[i];}ans=c[1];for(int i=2;i<n;i++){ans=__gcd(c[i],ans);}//cout<<ans<<endl;//int pos=lower_bound(b+1,b+m+1,k)-b;for(int i=1;i<=m;i++){if(ans==b[i]||ans%b[i]==0){cout<<"YES"<<endl;cout<<a[1]<<" "<<i<<endl;return 0;}}cout<<"NO"<<endl;//}#ifdef DEBUGprintf("Time cost : %lf s\n",(double)clock()/CLOCKS_PER_SEC);
#endif//cout << "Hello world!" << endl;return 0;
}

Alarm Clocks Everywhere相关推荐

  1. Android核心程序之SystemUI - (一)开篇

    UI是实现用户交互的重要途径之一,而Android中一个重要的UI元素就是SystemUI,本文分析基于Android 5.1,分析SystemUI的启动及运行过程. SystemUI源代码所在路径为 ...

  2. 浙南联合训练赛20180414

    这次题目的代码都不长,CF的一贯风格 A - Game CodeForces - 513A Two players play a simple game. Each player is provide ...

  3. Android源码学习------SystemUI(二)

    SystemUI----AndroidManifest文件 AndroidManifest是Android应用程序中最重要的文件之一.它是Android程序的全局配置文件,是每个 android程序中 ...

  4. Android之Manifest文件

    在Android APP开发过程中,Manifest文件举足轻重.每一个apk都要有一个Manifest文件,它配置了apk在Android系统上的基本信息. 如下 frameworks/base/p ...

  5. 发光二极管二极管引脚_LCD? 发光二极管? 等离子体? HDTV技术入门指南

    发光二极管二极管引脚 With image technology progressing faster than ever, High-Def has become the standard, giv ...

  6. SDNU_ACM_ICPC_2020_Winter_Practice_4th [Reproduced]

    文章目录 B - So Easy! C - Reading comprehension HDU - 4990 F - TOYS POJ - 2318 H - Triangle I - Birthday ...

  7. usb延长线线序_我应该使用哪种延长线?

    usb延长线线序 Extension cords are one of the most common household items, but there are many different ki ...

  8. 信号Signals--APUE第三版

    10.1 介绍 Signals 提供了一种 处理异步事件的 方式, 例如用户在中断 键入ctrl + C 来终止一个程序. 我们即将描述的就是 POSIX.1 标准化的 reliable-signal ...

  9. 日出时间 算法_如何便宜地建立日出闹钟

    日出时间 算法 Sunrise-simulating alarm clocks are a great way to wake yourself up in the mornings, but com ...

最新文章

  1. 为什么要使用Retrofit封装OkHttp,而不单独使用OkHttp?
  2. sola ris 简单命令
  3. 学军中学推理社2017届招新试题
  4. vue笔记整理与总结
  5. MySQL死锁案例分:先delete,再insert,导致死锁
  6. slackware启动脚本详解
  7. 设置devenv.exe启动版本(转)
  8. scan camera
  9. 手机内置摄像头接线图解_坚果R2 手机官方壁纸
  10. SyntaxError: Non-UTF-8 code starting with '\xb5' in file“问题解决办法
  11. 二维数组的定义和访问
  12. python绘制动态k线及均线_Python绘制股票移动均线的实例
  13. 群论(Burnside引理和Polya定理)
  14. [Mysql]查看mysql默认密码
  15. Java面试题大全(整理版)1000+面试题附答案详解,最全面详细,看完不进你找我
  16. DaoCloud道客云原生开源项目KLTS,全称为Kubernetes Long Term Support,为Kubernetes早期版本提供长期免费的维护支持
  17. 技术分享 | 无人驾驶汽车的眼睛
  18. 云原生之史上最全K8S环境搭建(强烈建议收藏)
  19. python 绘制函数曲线图
  20. LXD虚拟容器及常用命令

热门文章

  1. oracle 根据spid查sql,探讨:Oracle数据库查看一个进程是如何执行相关的实际SQL语句...
  2. java怎么用柱形图_java绘制柱形图
  3. php网页打开输入密码,PHP输入密码查看网页
  4. mysql数据库事务日志已满_服务器事务日志已满解决方法
  5. 计算机错误2 找不到指定文件,无法执行目录中的文件 错误2系统找不到指定文件怎么办?...
  6. java程序阅读技巧_Java程序员阅读源码的小技巧,原来大牛都是这样读的,赶紧看看!...
  7. java 对象的定义是_浅析Java编程中类和对象的定义
  8. qt插件元数据不包含一个有效的元数据_Qt5个人软件插件使用(低级API)
  9. Map和hashmap
  10. linux配置usb主从_一种Linux下USB设备主从切换的实现