当前位置:网站首页>7-1 understand everything
7-1 understand everything
2022-06-28 07:23:00 【wow_ awsl_ qwq】
7-1 Know everything.
fraction 20
author DAI, Longao
Company Hangzhou Baiteng Education Technology Co., Ltd
b3ceb051352ac65c29767cc3ecf2b21192138add.jpg
as everyone knows , There are many words on the Internet that are not easy to say directly , However, some vague pictures can still make netizens understand what you are talking about . However, we must still give a heavy blow to this kind of speech , So please implement a simple matching algorithm .
Now we have collected some characteristic data of the original image , from N Less than 255 Composed of nonnegative integers , Suppose that for a given number of sheets M
i
Two are also less than 255 The characteristic data of the new graph composed of nonnegative integers , Each data can be calculated from the average of any four different data in the original figure , The new picture is called a similar picture of the original picture . For the given data , Please judge whether it's a similar picture .
Be careful , Different data does not mean different values of data , Instead, you can't take the same data multiple times . For two data with the same value , If you give it twice , You can take it twice .
Input format :
The first line of input is two integers N,K (1 ≤ N ≤ 50, 1 ≤ K ≤ 200), Indicates the number of characteristic data of the collected original drawing and the number of new drawings .
The next action N Less than 255 Non-negative integer , Represent the characteristic data of the original drawing .
final K That's ok , The first number in each line is M
i
(1 ≤ M
i
≤ 200), Represents the number of characteristic data of the new graph . And then there was M
i
Less than 255 Non-negative integer , Represent the characteristic data of the new graph .
Output format :
For each new picture , If it is a similar picture , Output in one line Yes, Otherwise output No.
sample input :
5 3
4 8 12 20 40
3 11 16 19
3 12 16 19
10 11 11 11 11 11 11 11 11 11 11
sample output :
Yes
No
Yes
#include <bits/stdc++.h>
using namespace std;
int a[100],b[4];
bool st[1200];
int n,k;
void dfs(int t,int x)
{
if(t==4)
{
int s=0;
for(int i=0;i<4;++i)s+=b[i];
//s/=4;
st[s]=true;
return ;
}
for(int i=x;i<n;++i){
b[t]=a[i];
dfs(t+1,i+1);
}
}
int main()
{
cin>>n>>k;
for(int i=0;i<n;++i)cin>>a[i];
dfs(0,0);
while(k--)
{
int t;cin>>t;
bool flag=true;
for(int i=0;i<t;++i)
{
int x;cin>>x;
x*=4;
if(st[x]==false){
flag=false;
}
}
if(flag)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
return 0;
}
边栏推荐
- mysql57 zip文件安装
- Jinshan cloud team shared | 5000 words to understand how Presto matches with alluxio
- R 语言绘制 动画气泡图
- NDK 交叉编译
- 一个小工具可以更快的写爬虫
- Techo day Tencent technology open day, June 28 online waiting for you!
- GoLand IDE and delve debug Go programs in kubernetes cluster
- An important term in MySQL -- CRUD
- DOM parsing of XML file case code sentence by sentence analysis
- What is EC blower fan?
猜你喜欢

"Jay bear" plummeted by 96.6%. Why is NFT with star goods cold?

Techo day Tencent technology open day, June 28 online waiting for you!

Recommend several 0 code, free, learning and using visualization tools

ABAP skill tree

扩展Prometheus的解决方案thanos的简介和几个月使用心得

kubernetes删除pod的流程的源码简析

Application and Optimization Practice of redis in vivo push platform

Block transmission by golang gin framework

Compile configuration in file

PLC -- Notes
随机推荐
C language tutorial
MySQL installation steps - Linux configuration file JDK installation (II)
Encyclopedia of scala operators
Jetpack - defects of livedata component and Countermeasures
服务器正文18:UDP可靠传输的理解和思考(读云凤博客有感)
Mysql8.0 and mysql5.0 accessing JDBC connections
DOM parsing of XML file case code sentence by sentence analysis
卸载重装最新版mysql数据库亲测有效
Kubernetes deploys a secret pit where thanos ruler sends repeated alarms
Detailed explanation of collection class methods____ (4) Judgment and assignment, etc
Top 25 most popular articles on vivo Internet technology in 2021
kubernetes部署thanos ruler的发送重复告警的一个隐秘的坑
flutter 实现摇一摇功能
"Jay bear" plummeted by 96.6%. Why is NFT with star goods cold?
How bacnet/ip gateway collects data of building centralized control system
ABAP 技能树
LeetCode+ 51 - 55 回溯、动态规划专题
A gadget can write crawlers faster
7-1 懂的都懂
Sword finger offer II 091 Paint the house