爆刷PAT(甲级)——之【1142】 Maximal Clique(25 分)——图论

Unity UI Toolkit避坑指南:从官方Samples到实际项目,这些‘坑’我帮你踩过了 本文分享了Unity UI Toolkit在实际项目中的避坑经验和优化技巧,包括动画系统的高效替代方案、3D世界UI的创新实现方式、USS样式继承的反直觉规则等。通过详细的代码示例和性能优化策略,帮助开发者避免常见陷阱,提升开发效率。 阅读详情

艰难的英语单词:clique       英 [kli:k]        派系;n.

题意:一张无向图,如果几个点之间,任意两个点都可达,叫做一个“块”。给一个图然后好几个序列,请判断它们是不是“块”、或是不“最大的块”(领接任意点都没法再加到块中成为更大的块)

难点:1、如何判断是不是块,很简单,各个点枚举一遍就好了

2、如何判断这个“块”是不是最大的“块”,可咋办呢?想了半天想不出一个高效的办法,后来网上一瞅。。。哦,暴力枚举一下饿。。。因为N小于200.

PS:考场没有Codeblocks,现在开始使用VS6.0,感觉是非常的奇妙啊。

ode:

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
using namespace std;
#define inf 209
int n,m,q;
int e[inf][inf];
vector<int>v;

int main()
{
	int i,j,k;
	scanf("%d%d",&n,&m);
	for(i=0;i<m;i++)//输入图
	{
		int a,b;
		scanf("%d%d",&a,&b);
		e[a][b]=e[b][a]=1;
	}
	scanf("%d",&q);
	for(i=0;i<q;i++)
	{
		int num;
		scanf("%d",&num);
		v.clear();
		for(j=0;j<num;j++)//输入clique
		{
			int t;
			scanf("%d",&t);
			v.push_back(t);
		}
		int flag=1;
		//开始判断 
		for(j=0;j<num;j++)
			for(k=j+1;k<num;k++)
				if(!e[v[j]][v[k]])
				{
					flag=0;break;
				}
		if(!flag)//输出不是
		{
			printf("Not a Clique\n");
			continue;
		}
		for(j=1;j<=n;j++)
		{
			int sum=0;
			for(k=0;k<num;k++)
				if(v[k]==j)break;
				else if(e[j][v[k]])sum++;
			if(sum==num)
			{
				flag=0;
				break;
			}
		}
		if(flag)printf("Yes\n");
		else printf("Not Maximal\n");
	}
	return 0;
}

 

零零信安:暗网分析报告——Part 4 商业黑客组织,“流星街”的原住 暗网,作为互联网的一部分,充满了神秘而又复杂的活动。更重要的是,其背后的主要参与者——商业黑客和各种有组织的犯罪集团,揭示了这是一个怎样的世界。本报告将试图带您了解这些原住民的身份、行为方式、商业逻辑、受害者以及他们构建的独特生态。 阅读详情

相关推荐

瑞萨芯片串口配置,基于RL78芯片的串口使用配置

在这里隆重给大家介绍瑞萨编辑器CS+ for CA 的自动生成代码功能,只需要配置几个参数,就可以得到你想要的串口配置了,我现在已经忘记怎么手动配置寄存器了,哈哈。选择设置,此时将端口设置成功接下来设置时钟,根据自己的芯片所需设置相应的时钟,自己芯片是什么时钟查看数据手册和原理图可以找到。瑞萨芯片的串口配置其实和ST芯片的串口配置差不多,只是ST芯片的中文数据手册比较多,就更好配置了,找到所需要的串口配置IO口,此时将UART0 配置为引脚P61和P62,瑞萨芯片的串口配置竟然要配置串口。

qq_45315904的博客 4311

1142 Maximal Clique

题目 题意:clique是一个点集,在一个无向图中,这个点集中任意两个不同的点之间都是相连的。maximal clique是一个clique,这个clique不可以再加入任何一个新的结点构成新的clique。点编号从1~nv,给出ne条边,以一对结点编号的方式给出。然后给出m条询问,每个询问是一个点集合,问这个点集合是否是maximal clique、是否是clique tip:先判断是否是...

qq_1300258993的博客 561

服务器安装Ubuntu 18.04.2 LTS超详细步骤(小白图文详解)

服务器安装Ubuntu 18.04.2 LTS超详细步骤(小白图文详解) 本文不包括启动盘制作步骤,相关内容可自行百度 华为服务器 1 插入u盘,关机重启 2 初始化界面后进入到系统的BIOS设置界面 (华为服务器按Del键,不同品牌方法不同) 3 进入的时候,华为的服务器默认设置了BIOS密码,因此需要输入之前预设的密码。 注意密码大小写问题,若密码输错三次,则需重启 4 密码输入以后,进入...

crystalbang的博客 2万+

PAT-ADVANCED1142——Maximal Clique

我的PAT-ADVANCED代码仓:https://github.com/617076674/PAT-ADVANCED 原题链接:https://pintia.cn/problem-sets/994805342720868352/problems/994805343979159552 题目描述: 题目翻译: 1142 最大Clique clique是无向图的顶点的子集,使得cliqu...

清风阁 358

告别Keil4!手把手教你用Keil C51 V9.61编译51单片机代码(附最新激活方法)

本文详细介绍了Keil C51 V9.61在51单片机开发中的全栈升级指南,包括编译速度提升、调试器性能优化和现代开发支持等核心优势。通过智能安装方案、项目迁移实战和新特性深度应用,帮助开发者告别Keil4,大幅提升开发效率。附有最新激活方法和实用技巧,适用于嵌入式开发工程师。

weixin_26886855的博客 429

AUTOSAR从入门到精通-中间件通信DDS(一)

汽车开放系统架构(automotive open system architecture,autosar)是由全球各大汽车oem、零部件供应商、汽车电子软件公司联合建立的一套标准协议。该协议规范了一个符合汽车电子软件开发的、开放的以及标准化的软件架构。最初的autosar规范的制定只考虑传统汽车电子电器架构,基于硬件算力有限场景,提供确定的功能。

getusushu的博客 1874

1142 Maximal Clique (PAT甲级)

一开始试图使用std::map<std::pair<int, int>, int>, 将所有相邻的点对保存下来。但有一个测试点超时了……其中std::map<std::pair<int, int>, int>需要自定义。

linh2006的博客 143

在Allegro设计界面中如何修改封装焊盘

在高密度板的情况下,SUIPLA(支持内层没有的焊盘摘掉)打勾,在高密度板的情况下,内层没有的焊盘摘掉可以增加走线的空间。3、修改完焊盘后,选择File→Update to Design(更新到设计)。然后关闭焊盘修改对话框即可。,将会定期不定期更新技术文章,互相学习交流。或者点击Options选项卡下要修改的焊盘,然后点击Edit修改。在Allegro PCB设计界面中修改封装焊盘的方法。2、然后点击封装上要修改的焊盘,右击选择Edit。修改完成后如下图所示。

bhxc809751502的博客 7816

PAT 1142 Maximal Clique

Clique:一个Clique里的任一两个顶点是相连的。 Maximal Clique:不存在Clique以外的顶点与Clique中的各点都相连。 这一题原来以为用二维矩阵会超时,结果AC了。 Nv个顶点(1-Nv),Ne条边,m次询问,k个询问的数为一个集合。 直接将相连的顶点用二维矩阵标记为1,自身也为1,将访问的顶点保存下来,并用数组将询问的顶点标记为1,先判断集合中的顶点是否都相连,不是输...

Genius_J的博客 210

自然语言处理之机器翻译:Transformer:Transformer在低资源语言翻译中的应用

Transformer模型是自然语言处理领域的一个重要突破,由Vaswani等人在2017年的论文《Attention is All You Need》中提出。它摒弃了传统的循环神经网络(RNN)和卷积神经网络(CNN)的序列依赖性,采用自注意力机制(Self-Attention)处理输入序列,极大地提高了训练效率和模型性能。

zhubeibei168的博客 1016

面向元数据的 SAP UI 中枢:namespace sap.ui.mdc 全景解析

如果把应用前端比作一条数据到交互的装配线,sap.ui.mdc 就是那条线的标准化工装:以 PropertyInfo 描述原料,以 Delegate 定义装配方法,以 p13n 与 VariantManagement 交付面向个体的最终产物;而 Condition Model、Operator 与 ValueHelp 则让输入与筛选的语义落地。与 OData V4 服务与 Fiori Elements 宏构件组合使用时,它能在保持一致体验的同时,给自由式开发者留下足够的可编排空间。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 244

PAT 甲级 1142 Maximal Clique (25 分)

A clique is a subset of vertices of an undirected graph such that every two distinct vertices in the clique are adjacent. A maximal clique is a clique that cannot be extended by including one more adj...

zhaohaibo的博客 518

AI视频生成工作流开发:从产品拆解到带货视频全流程实现

本文介绍了一套完整的AI视频生成工作流开发方案,该系统能够自动分析产品素材并生成9个标准化分镜,支持白底图智能替换,最终输出专业带货视频。系统基于Coze平台搭建,整合豆包大模型及多模态生成模型,实现从产品分析、脚本生成到视频合成的全流程自动化。关键模块包括产品特征提取、智能分镜分配、视觉内容生成和用户交互调整,支持手动优化提示词和输出结果。该方案采用模块化设计,结合多种AI模型协同工作,为电商视频制作提供高效解决方案。

huanghm88的专栏 398

【PAT甲级】1142 Maximal Clique

📣专栏定位:为想考甲级PAT的小伙伴整理常考算法题解,祝大家都能取得满分!

Newin2020的博客 433

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

PAT甲级 1142 Maximal Clique (25 分) 暴力

题意: 给定无向图,再给一个点集,问是不是 MC,C,或者两者都不是 思路:1142Maximal Clique(25分) C就是给定的点集中任意两个点直接相连 MC就是不存在其他点,跟点集中的所有点相连 MC 包含于C 这样的关系 应当先判断两者都不是的情况 #include<bits/stdc++.h> #include<cstring>...

床前明月光 279

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

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

PAT甲级 1142 Maximal Clique (25分) 图/C++

1142 Maximal Clique (25分) 题目大意:找到两两相连的最大clique。 需要先判断是否两两相连(首先需要满足的条件,必须先判定),确定是两两相连以后再判断是否为最大clique #include<iostream> #include<vector> using namespace std; int n,m; int a[201][201]={0}; vector<int> check; void isClique(int flag[],int kn

qq_43955154的博客 237

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

PAT 甲级 1142  Maximal Clique

1142Maximal Clique(25 point(s)) Acliqueis a subset of vertices of an undirected graph such that every two distinct vertices in the clique are adjacent. Amaximal cliqueis a clique that cannot be...

漫浸天空的雨色的备忘录~ 860

17年秋季第三题 PAT甲级 1142 Maximal Clique (25分)

汇总贴 2020年3月PAT甲级满分必备刷题技巧 题目 来源:https://pintia.cn/problem-sets/994805342720868352/problems/994805343979159552 Acliqueis a subset of vertices of an undirected graph such that every two distinct ve...

qiiingc的解题记录 837

PAT 1142. Maximal Clique (25) - 甲级

A clique is a subset of vertices of an undirected graph such that every two distinct vertices in the clique are adjacent. A maximal clique is a clique that cannot be extended by including one more adj...

柳婼 の blog 4351

【PAT甲级A1142】 Maximal Clique (25分)(c++)

1142 Maximal Clique (25分) 作者:CHEN, Yue 单位:浙江大学 代码长度限制:16 KB 时间限制:400 ms 内存限制:64 MB A clique is a subset of vertices of an undirected graph such that every two distinct vertices in the clique are adjacent. A maximal clique is a clique that cannot be extende

小庄同学的博客 150

PAT甲级1142 Maximal Clique (25 分)

1142Maximal Clique(25分) Acliqueis a subset of vertices of an undirected graph such that every two distinct vertices in the clique are adjacent. Amaximal cliqueis a clique that cannot be extend...

Dexter 223

PAT甲级1142 Maximal Clique (25分)|C++实现

一、题目描述 原题链接 A clique is a subset of vertices of an undirected graph such that every two distinct vertices in the clique are adjacent. A maximal clique is a clique that cannot be extended by including one more adjacent vertex. (Quoted from https://en.wikipe

weixin_42393947的博客 150

pat甲级1142 Maximal Clique

A。

2303_76815666的博客 447

1142 Maximal Clique-PAT甲级

A clique is a subset of vertices of an undirected graph such that every two distinct vertices in the clique are adjacent. A maximal clique is a clique that cannot be extended by including one more adj...

amf12345的博客 185

PAT——1142 Maximal Clique 甲级

1142 Maximal Clique题目题意题目解析AC代码参考 题目 https://pintia.cn/problem-sets/994805342720868352/problems/994805343979159552 题意 题目中的Clique是一个点集合,里面的点在给定的图中两两相邻 而 Maximal Clique 就是指如果再向这个点集合中加入图中的其他任意点,无法满足两两相邻的条件,因此当前的点集合就是最大的 题目解析 将给定的边记录在图f中,通过两两比较判断待测序列的点是否符合Cliq

ljhsq的博客 125

PAT甲级1142 Maximal Clique :[C++题解]图论、最大团、枚举

刷题

阿正的梦工坊 531
上一篇: 爆刷PAT(甲级)——之【1145】 Hashing - Average Search Time(25 分)——Hash
下一篇: 【算法模板】Dijkstra 赤裸绿色版本,手敲留念~
仰天倀笑
博客等级 码龄10年 313粉丝 124原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值