[codevs]2066三角恋

人工智能混合编程实践:C++调用封装好的DLL进行异常检测推理 C++、Python、ONNX、人工智能、异常检测、Anomalib 2.1.0 阅读详情

题目描述 Description

人们的恋爱关系与如下特点:两个人a,b,如果a爱着b,那么b一定不爱a;如果a不爱b,那么b一定爱着a(yh的研究成果果然与众不同……)。

现在,yh想知道,在n个人当中,是否存在三角恋现象(即a爱着b,b爱着c,c爱着a)。

输入描述 Input Description

本题有多组测试数据

第一行一个整数t,表示有t组测试数据。

对于每组数据,第一行为一个整数n,表示共有n人。

接下来为n*n的0,1矩阵a,如果a[i,j]=1,则i爱着j,否则表示i不爱j;数据保证a[i,j]<>a[j,i]。

输出描述 Output Description

每组数据输出一行,如果存在三角恋,输出’Yes’,否则输出’No’。

样例输入 Sample Input

2

5

00100

10000

01001

11101

11000

5

01111

00000

01000

01100

01110

样例输出 Sample Output

Yes

No

tarjan找环,也可以拓扑做。

tarjan

#include<iostream>
#include<stack>
#include<cstring>
#include<cstdio>
using namespace std;
const int MAXN = 2000 + 50;
stack <int> s;
int l[MAXN][MAXN];
int n,T,cnt[MAXN];
char a[MAXN];
int low[MAXN],dfn[MAXN],dfn_cnt,size[MAXN],sccn[MAXN],sccn_cnt;
void tarjan(int u)
{
    low[u] = dfn[u] = ++ dfn_cnt;
    s.push(u);
    for(int i = 1;i <= cnt[u];i ++)
    {
        int v = l[u][i];
        if(!dfn[v])
        {
            tarjan(v);
            low[u] = min(low[u],low[v]);
        }
        else if(!sccn[v])
        {
            low[u] = min(low[u],dfn[v]);
        }
    }
    if(low[u] == dfn[u])
    {
        ++ sccn_cnt;
        while(!s.empty())
        {
            int t = s.top();
            s.pop();
            sccn[t] = sccn_cnt;
            size[sccn_cnt] ++;
            if(dfn[t] == low[t])break;//if(t == u)break;
        }
    }
}
int main()
{
    cin >> T;

    while(T --)
    {
        memset(cnt,0,sizeof(cnt));
        memset(dfn,0,sizeof(dfn));
        memset(sccn,0,sizeof(sccn));
        memset(size,0,sizeof(size));
        memset(low,0,sizeof(low));
        while(!s.empty())s.pop();
        dfn_cnt = sccn_cnt = 0;
        cin >> n;
        for(int i = 1;i <= n;i ++)
        {
            cin >> a;
            for(int j = 1;j <= n;j ++)
            {
                if(a[j - 1] == '1')l[i][++ cnt[i]] = j;
            }
        }
        for(int i = 1;i <= n;i ++)
        {
            if(!dfn[i])tarjan(i);
        }
        bool flag = false;
        for(int i = 1;i <= sccn_cnt;i ++)
        {
            if(size[i] >= 3)
            {
                printf("Yes\n");
                flag = true;
                break;
            }
        }
        if(!flag)printf("No\n");
    }
}

拓扑

#include<iostream>
#include<cstdio>
#include<queue>
#include<cstring>
using namespace std;
const int MAXN = 2000 + 50;
queue <int> q;
int T,tot;
char a[MAXN];
int cnt[MAXN],l[MAXN][MAXN],ru[MAXN],n;
bool inq[MAXN];
void init()
{
    while(!q.empty())q.pop();
    memset(cnt,0,sizeof(cnt));
    memset(ru,0,sizeof(ru));
    memset(inq,0,sizeof(inq));
    tot = 0;
}
int main()
{
    scanf("%d",&T);
    while(T --)
    {
        init();
        scanf("%d",&n);
        for(int i = 1;i <= n;i ++)
        {
            scanf("%s",a + 1);
            for(int j = 1;j <= n;j ++)
            {
                if(a[j] == '1'){
                    l[i][++ cnt[i]] = j;
                    ru[j] ++;
                }
            }
        }
        for(int i = 1;i <= n;i ++)
        {
            if(ru[i] == 0)
            {
                q.push(i);
                tot ++;
            }
        }
        while(!q.empty())
        {
            int u = q.front();
            q.pop();
            for(int i = 1;i <= cnt[u];i ++)
            {

                ru[l[u][i]] --;
                if(ru[l[u][i]] == 0)
                {
                    q.push(l[u][i]);
                    tot ++;
                }
            }
        }
        if(tot == n)printf("No");
        else printf("Yes");
        printf("\n");
    }
    return 0;
}
【Yolo12改进策略】MRFA 小核协同,构建巨大的感受野,同时保持高斯型分布|即插即用|ICCV2025 本文将介绍如何将 UniConvNet 论文中的核心模块——感受野聚合器集成到 Yolo12中,通过一种新颖的“小核协同”范式,在不显著增加计算开销的前提下,显著提升模型的感受野质量和检测精度。在目标检测中,模型要识别一个物体,不仅需要看到物体的局部特征,更需要理解其周围的上下文信息。传统卷积网络通过堆叠小卷积核(如 3x3)来扩大“感受野”,但这个过程缓慢且效率低下。而近期流行的大核卷积,虽然感受野大,但会破坏“距离越近、影响越大”的自然分布,且带来巨大的计算负担。MRFA 找到了一条“中间道路”:它通过 阅读详情

相关推荐

汉字跨越三千年的生命力与数字时代适应性

文字作为文明载体,其演变规律始终遵循实用性与适应性的平衡。汉字作为现存最古老的文字系统,凭借形义结合的六书构造原理,实现了超方言的文化统一功能。在计算机处理方面,五笔输入法与Unicode支持证明了其技术兼容性,而视觉识别效率的先天优势使其在信息时代更具传播效力。从甲骨文识别AI到现代书法设计,汉字系统持续展现强大的文化承载力与技术适应性,这种活态传承为数字人文研究提供了独特样本。

weixin_29058331的博客 353

code vs三角恋

2066 三角恋  时间限制: 1 s  空间限制: 128000 KB  题目等级 : 钻石 Diamond 题解  查看运行结果 题目描述 Description 人们的恋爱关系与如下特点:两个人a,b,如果a爱着b,那么b一定不爱a;如果a不爱b,那么b一定爱着a

clover_hxy的博客 598

边缘设备选型指南:从数据采集到AI推理,工业物联网硬件如何匹配你的需求?

本文提供了一份全面的工业物联网边缘设备选型指南,系统性地阐述了如何根据数据采集、协议兼容性、边缘AI推理算力及环境适应性等核心需求匹配硬件。文章深入剖析了从CPU/GPU/NPU选择到MQTT、Sparkplug B等工业协议支持的实战考量,并强调了软件生态与全生命周期成本的重要性,旨在帮助项目负责人在复杂场景中做出明智决策。

weixin_29168813的博客 88

【codevs2066】三角恋

人得自己成全自己

zyf2000 903

KUKA 虚拟调试实战——打通Simpro4.1与OfficeLite8.6的通信与实时控制链路

本文详细介绍了KUKA虚拟调试实战,重点解析如何打通Simpro4.1与OfficeLite8.6的通信与实时控制链路。通过环境搭建、权限配置、机器人型号匹配等关键步骤,帮助工程师高效完成机器人轨迹规划和PLC联锁逻辑验证,大幅降低真机调试风险。文章还提供了典型报错解决方案和实时控制优化技巧,适用于工业机器人仿真与培训场景。

weixin_30907935的博客 445

一文介绍Linux EAS

EAS只在系统负载不重时,即系统中每个CPU的利用率都低于其算力的80%时才被启用,而且选出的最节能CPU只有比线程当前运行的CPU节约能量大于6%时,线程才会迁移到该CPU运行。因此EAS为线程选择最节约能量的CPU来运行的前提条件是很苛刻的,针对重载场景(比如游戏),EAS的功能应该很少被使用起来,针对重载场景的功耗优化,这里可能是一个值得尝试的点。算力(capacity)是CPU调度中的一个基础概念,它反映的是一个CPU的计算能力,是个规格化的值,可以通过读取Android手机的文件节点。

youzhangjing_的博客 1234

codevs 2066 三角恋(dfs)

题目描述 Description 人们的恋爱关系与如下特点:两个人a,b,如果a爱着b,那么b一定不爱a;如果a不爱b,那么b一定爱着a(yh的研究成果果然与众不同……)。 现在,yh想知道,在n个人当中,是否存在三角恋现象(即a爱着b,b爱着c,c爱着a)。 输入描述 Input Description 本题有多组测试数据 第一行一个整数t,表示有t组测试数据。

Loi_yuan的博客 647

PCL 平面点云的凹多边形边界提取【2025最新版】

平面点云的凹多边形边界提取及边界轮廓线绘制。博客长期更新,本文最近更新时间为:2025年1月6日。

点云侠的博客 7183

顺序三角恋

代码:package ls;import java.util.Scanner;public class sanjiao {public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("请输入行数:"); int k = sc.nextInt();

贵州-龙松松 247

SCADA|KingSCADA通过组合框选择修改变量的值

《SCADA项目中组合框控件的使用方法》 本文详细介绍了SCADA系统中组合框(下拉框)控件的应用方法。通过具体示例演示如何实现:当选择"雷工笔记"时变量值为100,选择"雷工杂谈"时为200,选择"小李食代"时为300的功能。主要实现步骤包括:1)创建项目并添加组合框控件;2)设置Items选项及对应数值;3)创建内存变量;4)使用GetCurrentIndex()和GetItemData()方法;5)在选项变化事件中编写脚本。该控件在SCADA

做有价值的事,积累有价值的笔记! 864

小红书urlscheme和Activity

本文档详细介绍了小红书App的Deeplink跳转规范,涵盖了多个功能模块的跳转协议。主要内容包括:主页各Tab(关注、发现、购买)的跳转方式;不同类型笔记(图文/视频/长笔记)的详情页跳转参数;用户相关页面(主页/绑定/资料/消息等)的跳转协议;搜索功能(输入页/结果页)的跳转方式;以及话题、标签、专辑、H5页面等特殊场景的跳转实现。文档还提供了各跳转协议所需的参数说明,包括参数类型、默认值、是否必填等详细信息,并标注了不同版本和平台的兼容性要求。

代码简单说 Vue、JAVA、PHP、Node.js 熟练运用,接口、架构、性能全搞定。 786

codevs 2066 三角恋

2066 三角恋 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 钻石 Diamond 题解 题目描述 Description 人们的恋爱关系与如下特点:两个人a,b,如果a爱着b,那么b一定不爱a;如果a不爱b,那么b一定爱着a(yh的研究成果果然与众不同……)。现在,yh想知道,在n个人当中,是否存在三角恋现象(即a爱着b,b爱着c,c爱着a)。输入描述 I

Mercury的博客 412

QGis软件 —— 9、QGis - 由点绘制热力图来模拟人流量(绘制点方式、excel导入数据方式)

QGis软件 —— 9、QGis - 由点绘制热力图来模拟人流量(绘制点方式、excel导入数据方式)

1469

Codevs 2066 三角恋

题目描述 Description 人们的恋爱关系与如下特点:两个人a,b,如果a爱着b,那么b一定不爱a;如果a不爱b,那么b一定爱着a(yh的研究成果果然与众不同……)。 现在,yh想知道,在n个人当中,是否存在三角恋现象(即a爱着b,b爱着c,c爱着a)。 输入描述 Input Description 本题有多组测试数据 第一行一个整数t,表示有t组测试数据。

苦鬼·。 409

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

深度学习工具包 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")

[Dest0g3 misc] Pngenius,EasyEncode,知道js吗,StringTraffic,Easyword,Python_jail,codegame

misc需要不断的装软件太烦人了。 目录 Pngenius easyEncode 你知道js吗 StrangeTraffic easyWord Python_jail codegame Pngenius 下来是个图片,估计就是图版隐写。用binwalk分离出压缩包,有密码。再回到图片,用Stegsolve.jar打开看rgb通道的末位数据得到密码 50617373776f7264 20666f72207a6970 Password for zip 3a5765616b5f50

weixin_52640415的博客 1284

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

三角关系

为了提高集训队同学的学习效率,赵老师决定将所有队员组成三人小组,以组为单位进行训练。但是如何分组,让赵老师头疼。最后决定让每个队员自己选择一名想要组队的队友。于是,小龙选择了小慜,小慜选择了小泰,小泰选择了小龙,这样选择后就构成三角关系,他们可以直接组成三人小组。现在你需要判断在所有队员进行选择后能不能直接构成三角关系,组成三人小组。 输入格式: 输入有两行,第一行是一个正整数n(n≤5000),表示总人数。第二行有N个整数x​1,x2,⋯,xn,其中x​i表示第i个人想要与x​i组队。 输出格式: 如果能

swj_on_the_way的博客 266

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

Love Triangle (三角恋) Visual Judge (Set3)

文章目录题目描述输入描述输出描述输入输出样例线索提示一、解题思路二、题解源代码VJudge评判结果写在最后 题目描述 Love Triangle (三角恋) 告诉你每个人喜欢谁,问你这堆人里面有没有三角恋存在 输入描述 第一行输入一个整数N(2≤  N  ≤5000),表示有N个人 第二行输入整数F1,F2,F3,⋯  ,FN  (1⩽Fi⩽N,Fi≠i)F_1,F_2,F_3, \cdots \,\,,F_N\,\,\left( 1\leqslant F_i\leqslant N,F_i\ne i .

LeungSr的博客 643

ABAP程序信息/ABAP程序标题/事物代码(T-CODE)存放的数据库表

表1:REPOSRC ABAP程序相关信息 表2:TRDIRT ABAP程序标题行

王小磊 2743

三角恋之指针,数组,函数

指针数组,数组指针,傻傻分不清 首先,指针数组肯定是一个数组,是一个用来存放指针的数组。 同样,数组指针肯定是一个指针,是用来指向一个数组的指针。 举例: int *arr1[10]; char *arr2[4]; char **arr3[5]; 上面的三个都是指针数组,因为[ ]的优先级高于 *,所以arr先与[ ]结合。 int (*p)[10]; 这是一个数组指针。p先

如故的博客 538

用最新的laravel做中大型项目会出现的问题 全部标题文字给我==API + 前端 + 测试。

1.课程目标: 1.1:原型怎么写? 1.2:prototype的特点是什么? 1.3:对象的三角恋关系是怎么样的?

qq_37805832的博客 2074

HDOJ 4324 Triangle LOVE(拓扑排序判断有向图是否存在环)

Triangle LOVE Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 3981    Accepted Submission(s): 1572 Problem Description Recently,

Chunzhen的博客 663

Triangle LOVE(拓扑排序)

三角恋 时间限制:2000/1000 MS(Java/其他) 内存限制:65536/65536 K(Java/其他) 提交总数:6243 已接受提交:2337 问题描述 最近,科学家发现两个人中的任何一个都存在爱情。比如A和B之间,如果A不爱B,那么B一定爱A,反之亦然。而且没有两个人相爱的可能,这真是一个疯狂的世界! 现在,科学家想知道N个人之间是否存在“三角恋”。 “三角恋”是指任意三个人(A、B、C)中,A爱B,B爱C,C爱A。 你的问题是先写一个程序读取N个人之间的关系,然后返回是否有“三角恋”。

qq_51122012的博客 364

[codevs4175]收费站

二分 + spfa,对最短路和二分都有练习的题目

LOI_pingxing的博客 724

[codevs1391]伊吹萃香

题目←东方系列的可做题…… 每点有原色 -> 反色两种状态,所以把数组开双倍大 i表示原色,i+n表示与原色颜色相反 注意在路上走也是消耗时间的,到达时目标点已经变色了 建好图之后暴力跑最短路就可以了,最后在n和n + n里取min 其实spfa和dij都能过,一开始T掉是因为数组开小了……#include<iostream> #include<cstdio> #include<algor

LOI_pingxing的博客 708

[洛谷P1902]刺杀大使

题目←总觉得spfa一脸可做的样子然而过不了 于是乖乖打了二分+验证#include<iostream> #include<cstdio> #include<queue> #include<cstring> #include<algorithm> using namespace std; const int MAXN = 1000 + 50; int mr[] = {0,1,-1,0},

LOI_pingxing的博客 706
上一篇: [codevs1766]装果子
下一篇: [codevs1052]地鼠游戏
LOI_pingxing
博客等级 码龄10年 24粉丝 103原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值