Codeforces #406 (Div. 2 A. The Monster&B. Not Afraid (暴力

ASP.NET Padding Oracle漏洞原理解析与防御实战 Padding Oracle是一种利用加密系统错误反馈进行侧信道攻击的基础密码学威胁,核心在于分组密码(如AES-CBC)的PKCS#7填充机制与服务端异常响应之间的信息泄露。其原理并非破解算法本身,而是通过HTTP状态码(如500/404)或响应时间等‘Oracle’信号,逐字节推导明文乃至密钥流。该攻击在.NET平台尤为典型,广泛影响ViewState、FormsAuthentication及WebResource.axd等默认组件,本质暴露了框架默认安全配置与错误处理策略的深层风险。本文结合.NET底 阅读详情

A. The Monster

time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

A monster is chasing after Rick and Morty on another planet. They’re so frightened that sometimes they scream. More accurately, Rick screams at times b, b + a, b + 2a, b + 3a, … and Morty screams at times d, d + c, d + 2c, d + 3c, ….

The Monster will catch them if at any point they scream at the same time, so it wants to know when it will catch them (the first time they scream at the same time) or that they will never scream at the same time.

Input

The first line of input contains two integers a and b (1 ≤ a, b ≤ 100).

The second line contains two integers c and d (1 ≤ c, d ≤ 100).

Output

Print the first time Rick and Morty will scream at the same time, or  - 1 if they will never scream at the same time.

Examples
Input
20 2
9 19
Output
82
Input
2 1
16 12
Output
-1
Note

In the first sample testcase, Rick’s 5th scream and Morty’s 8th time are at time 82.

In the second sample testcase, all Rick’s screams will be at odd times and Morty’s will be at even times, so they will never scream at the same time.

瞎暴力

#include <cstdio>
#include <algorithm>
using namespace std;
#define LL long long
#define INF 0x3f3f3f3f
#define N 10000
int arr[N], brr[N];

int main()
{
    int a, b, c ,d;
    scanf("%d%d%d%d",&a,&b,&c,&d);
    for(int i = 0;i < N; i++) {
        arr[i] = b+ a*i;
        brr[i] = d+ c*i; 
    }   
    int k;
    bool flag = false;
    for(int i = 0;i < N; i++) {
        for(int j = 0;j < N; j++) {
            if(arr[i] == brr[j]) {
                flag = true;
                k = i;
                break;
            }
        }
        if(flag) break;
    }
    if(flag) printf("%d\n",arr[k]);
    else puts("-1");
return 0;
} 

B. Not Afraid

time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Since the giant heads have appeared in the sky all humanity is in danger, so all Ricks and Mortys from all parallel universes are gathering in groups to find a solution to get rid of them.

There are n parallel universes participating in this event (n Ricks and n Mortys). I. e. each of n universes has one Rick and one Morty. They’re gathering in m groups. Each person can be in many groups and a group can contain an arbitrary number of members.

Ricks and Mortys have registered online in these groups. So, a person can have joined a group more than once (developer of this website hadn’t considered this possibility).

Summer from universe #1 knows that in each parallel universe (including hers) exactly one of Rick and Morty from that universe is a traitor and is loyal, but no one knows which one. She knows that we are doomed if there’s a group such that every member in that group is a traitor (they will plan and destroy the world).

Summer knows that if there’s a possibility that world ends (there’s a group where all members are traitors) she should immediately cancel this event. So she wants to know if she should cancel the event. You have to tell her yes if and only if there’s at least one scenario (among all 2n possible scenarios, 2 possible scenarios for who a traitor in each universe) such that in that scenario the world will end.

Input

The first line of input contains two integers n and m (1 ≤ n, m ≤ 104) — number of universes and number of groups respectively.

The next m lines contain the information about the groups. i-th of them first contains an integer k (number of times someone joined i-th group, k > 0) followed by k integers vi, 1, vi, 2, …, vi, k. If vi, j is negative, it means that Rick from universe number  - vi, j has joined this group and otherwise it means that Morty from universe number vi, j has joined it.

Sum of k for all groups does not exceed 104.

Output

In a single line print the answer to Summer’s question. Print “YES” if she should cancel the event and “NO” otherwise.

Examples
Input
4 2
1 -3
4 -2 3 2 -3
Output
YES
Input
5 2
5 3 -2 1 -1 5
3 -5 2 5
Output
NO
Input
7 2
3 -1 6 7
7 -5 4 2 4 7 -3 4
Output
YES
Note

In the first sample testcase, 1st group only contains the Rick from universe number 3, so in case he’s a traitor, then all members of this group are traitors and so Summer should cancel the event.

瞎暴力

#include <cstdio>
#include <algorithm>
using namespace std;
#define LL long long
#define INF 0x3f3f3f3f
#define N 10000
int arr[N];

int main()
{
    int n, m;
    scanf("%d%d",&n,&m);
    int ans = m;
    int z = 0;
    while(m--) {
        bool flag = false;
        int k;
        scanf("%d",&k);
        for(int i = 0;i < k; i++) {
            scanf("%d",&arr[i]);
        }
        for(int i = 0;i < k; i++) {
            for(int j = 0;j < k; j++) {
                if(arr[i]==-arr[j]) {
                    flag = true;
                    break;
                }
            }
            if(flag) break;
        }
        if(flag) {
            z++;;
            flag = false;
        }
    }
    if(z==ans) puts("NO");
    else puts("YES");
return 0;
} 
使用Matlab进行IEEE 33节点潮流计算的NR法实现详解及应用实例 IEEE 33节点系统是一个标准的配电系统模型,广泛用于学术研究和工程应用。该系统由33个节点和37条线路组成,结构复杂,具有代表性。其潮流计算结果可用于验证各种潮流计算方法的准确性和效率。NR法是一种基于迭代求解的潮流计算方法,通过不断迭代求解非线性方程组,直到达到预定的收敛条件。NR法具有收敛速度快、计算精度高的优点,适用于大规模复杂电力系统的潮流计算。 阅读详情

相关推荐

论文解读——YOLOv11(目标检测)

YOLOv11提供了多种型号和功能,以满足不同应用场景的需求。对象检测对象检测是YOLOv11的基本功能之一。在训练时,YOLOv11能够检测图像中的对象,并输出对象的边界框和类别信息。这一功能在自动驾驶、智能安防等领域具有广泛应用。图像分割图像分割是YOLOv11的另一个重要功能。与对象检测不同,图像分割不仅检测对象的边界框,还能够对图像中的对象进行像素级别的分割。这使得YOLOv11在医疗影像分析、工业制造等领域具有更高的应用价值。姿态检测姿态检测是YOLOv11的一个独特功能。

qq_38220914的博客 4477

codeforces 787A the monster(扩展欧几里得做法+暴力做法)

A. The Monster time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output A monster is chasing after Rick and Morty on an

OJBFOWE的博客 983

卷王问卷考试系统——测试报告

本问卷考试系统是一款在线平台,支持用户发布和完成调查问卷,并进行考试管理,核心功能在于简化问卷创建发布、数据收集及考试组织流程。此次测试将围绕其关键模块展开,涵盖用户注册登录、项目列表、我的练习以及我的题库等核心部分。问卷考试系统(一)硬件环境普通办公电脑(CPU:Intel i5 、内存:16GB 、硬盘:512GB )(二)软件环境操作系统:Windows 11 ;浏览器:Chrome(版本 120+)、Firefox(版本 115+)、Edge(版本 120+)验证界面信息在完整性、一致性、准确性和用

m0_73433755的博客 566

Codeforces Round #406 (Div. 2)A+B(这鬼畜的英文)

A. The Monster time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output A monster is chasing after Rick and Morty on another planet. They’re so frig

妍恐龙的博客....^~^眼熟我 1547

FCN---训练cityspaces

未经允许,不要随意转载! 最近想试试用FCN训练自己的数据集,想想标注是一件很费劲的事,于是就想到了用其他库里的数据,这里选用了cityspaces,默认已经配置好FCN. 1、下载cityspaces https://www.cityscapes-dataset.com/ 需要注册一个账号 cityspaces包含2...

wangyu088的专栏 2043

基于python的奥运会历史数据分析【120年】

数据分析实战案例

xff123456_的博客 3342

B. Not Afraid STL set

B. Not Afraid time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Since the giant heads have appeared in the sk

Accepted ALL lve 1181

TL3562/3568内核驱动移植实战:解决无锡沐创N500L-AM4网口异常问题

本文详细介绍了在TL3562/3568平台上移植无锡沐创N500L-AM4网卡驱动的实战经验,重点解决了第四个网口通讯异常问题。通过升级驱动版本至rnpgbe-0.2.3,生成关键头文件并正确配置内核,最终实现四个网口稳定工作。文章还提供了性能优化建议和避坑指南,为类似硬件驱动移植项目提供参考。

weixin_28273593的博客 190

codeforces #406 A. The Monster

A monster is chasing after Rick and Morty on another planet. They're so frightened that sometimes they scream. More accurately, Rick screams at times b, b + a, b + 2a, b + 3a, ... and Morty screams

yeleng的博客 338

触摸延时灯课程设计

Multisim源文件下载: 实验名称:­­­­­­­­­­­­­­­­­­­ 课程设计1:触摸延时灯仿真设计 设计要求: 利用单稳态触发器设计触控延时灯,要求利用触发波形的边沿模拟触控点实现触发,触发后3秒灯亮,灯可以亮的时间可在5-10秒之间可调。 设计思路: 利用集成单稳态触发器CD4098设计简易的触摸延时灯电路。应用CD4098可以实现脉冲延时,原理图如下。4脚未触发信号输入端,可通过比较器对触摸产生的信号进行比较后再产生触发信号,使触发准确度得以提高。...

m0_54240221的博客 1万+

库卡kuka仿真软件sim Pro 3.1简单实用教程

实验目的 建立机器人,自定义抓手,导入外部模型,掌握工具坐标、基坐标的使用,自动生成轨迹。 实验步骤 打开KUKA.Sim Pro 3.1.2仿真软件,依次点击KUKA Sim Library 3.1 → KUKA_ROBOTS→Small Robots(3kg-10kg)→Archiv→AGILUS-1 Series→sixx,双击KR 6 R700 sixx,加载机器臂到工作空间; 加载自定义抓手。双击Miscellaneous,再双击圆锥Cone设置上半径为0,下半径为40,高为100; 点击“捕

weixin_45168199的博客 4万+

codeforces#406 A (拓展欧几里得水题)

A. The Monstertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputA monster is chasing after Rick and Morty on another planet. They're so frightened th...

keep coding 534

ArtMate —— 美术公开课智能体开发全记录

本文档详细描述了一款专为中小学美术公开课设计的智能教学助手的开发过程。该智能体融合了多模态感知、自然语言交互、风格迁移与智能评价等技术,旨在辅助教师开展生动、高效的美术鉴赏与创作课程。全文包含需求分析、系统架构设计、核心模块代码实现、交互界面搭建及完整运行示例,并配有详尽的行内注释和设计思想阐述,为教育技术开发者提供一份可落地、可扩展的参考方案。

huanghm88的专栏 159

Codeforces Round #375 (Div. 2) B. Text Document Analysis(字符串处理,简单题目)

题目链接:http://codeforces.com/contest/723/problem/B【分析】求不在括号里的单词的长度和在括号里的单词的个数。立个flag表示所处状态就好了,0表示不在括号内,1表示在括号内,然后再扫一遍就OK了。下面是AC代码:#include<cstdio> #include<cstring> #include<algorithm> using namespace st

linlinsong—ACM界蒟水! 456

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

CodeForces 787A A. The Monster(扩展欧几里得)

A. The Monster time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output A monster is chasing after Rick and Morty on

MM__1997的博客 1028

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

[CF] 787B Not Afraid

题目: Since the giant heads have appeared in the sky all humanity is in danger, so all Ricks and Mortys from all parallel universes are gathering in groups to find a solution to get rid of them.There ar

友谊无价 977

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

CF787A:The Monster(扩展欧几里得)

A. The Monster time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output A monster is chasing after Rick and Morty on

junior19的博客 964

codeforces 787A The Monster (猜想 + 证明)

解题思路: 这次是第二次做这道题,第一次做是这场比赛的时候,当时没怎么多想,因为是div2A,就感觉一定可以暴力解决,当时脑洞一开,觉得如果存在解就一定存在小于等于N的解。 赛后看题解的时候,发现题解和我的思路是一致的。开始寻求合理的证明,最开始一直往拓展欧几里得的方面去想,然后越想越复杂,一度放弃了。 这次和别人讨论这道题的时候突然发现了一个很简单的想法。 首先我们假设存在一组解(i,j

wchhlbt的博客 400

codeforces787B-Not Afraid

codeforces787B-Not Afraid  Since the giant heads have appeared in the sky all humanity is in danger, so allRicks and Mortys from all parallel universes are gathering in groups to find a solutio

x_ring的博客 406

Codeforces Round #406 (Div. 2)

题解 太晚了不太想写

fyc的博客 285

cfB. Luba And The Ticket time limit per test2 seconds memory limit per test256 megabytes inputstanda

B. Luba And The Ticket time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Luba has a ticket consisting of 6 di

Dosth_Magic 5068

Codeforces 918C - The Monster (贪心 + 思维 + 栈模拟)

思路: 首先明确题意:找符合要求的区间个数 很容易想到利用栈的括号匹配,枚举区间进行判断,此题多了问号的判断。 括号匹配不用栈的实现bool check(string s) { int top = 0; for(int i = 0; i < s.size(); ++i) { if(s[i] == '(') top++; else top

%%% 547

CodeForces 406A

Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix. The dot product of two integer number vectors x and y of size n is the...

qq_44134712的博客 213

【扩展欧几里得】Codeforces Round #406 (Div. 2) A. The Monster

扩欧,a+bx=c+dx,输出x>=0且y>=0,且a+bx最小的解。 要注意不能只保证x非负,还得看看能否保证y也非负。 #include<cstdio> #include<iostream> using namespace std; typedef long long ll; ll a,b,c,d; void exgcd(ll a,ll b...

weixin_34270865的博客 155

codeforces 918 C. The Monster(思维)

C. The Monster time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output As Will is stuck in the Upside Down, he can still communicate with his mom,...

henuzxy 641
上一篇: Poj 2031 Building a Space Station ( 最小生成树Krustra
下一篇: Codeforces #406 (Div. 2) B. Bear and Friendship Condition(并查集
Yishui_Blog
博客等级 码龄10年 96粉丝 524原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值