思路:

很有意思的思维题。

实现:

 #include <bits/stdc++.h>
using namespace std;
int check(vector<int>& v, set<pair<int, int>>& st)
{
int res = ;
map<pair<int, int>, int> mp;
for (int i = ; i <= ; i++)
{
for (int j = i; j <= ; j++)
{
mp[make_pair(i, j)] = ;
}
}
for (auto it: st)
{
int a = v[it.first - ], b = v[it.second - ];
pair<int, int> tmp(min(a, b), max(a, b));
if (mp[tmp] == )
{
mp[tmp] = ; res++;
}
}
return res;
}
int main()
{
int n, m, a, b;
while (cin >> n >> m)
{
set<pair<int, int>> st;
for (int i = ; i < m; i++)
{
cin >> a >> b;
st.insert(make_pair(min(a, b), max(a, b)));
}
if (n <= ) { cout << m << endl; continue; }
vector<int> a{, , , , , , };
int maxn = ;
do
{
maxn = max(maxn, check(a, st));
} while (next_permutation(a.begin(), a.end()));
cout << maxn << endl;
}
return ;
}

CF1210A Anadi and Domino的更多相关文章

  1. C. Anadi and Domino

    题目链接:http://codeforces.com/contest/1230/problem/C C. Anadi and Domino time limit per test: 2 seconds ...

  2. 588 div2 C. Anadi and Domino

    C. Anadi and Domino 题目链接:https://codeforces.com/contest/1230/problem/C Anadi has a set of dominoes. ...

  3. Anadi and Domino

    C - Anadi and Domino 参考:Anadi and Domino 思路:分为两种情况: ①n<=6,这个时候肯定可以保证降所有的边都放上一张多米诺牌,那么答案就是m ②n==7, ...

  4. Codeforces Round #588 (Div. 2) C. Anadi and Domino(思维)

    链接: https://codeforces.com/contest/1230/problem/C 题意: Anadi has a set of dominoes. Every domino has ...

  5. cf-1230C Anadi and Domino

    题目链接:http://codeforces.com/contest/1230/problem/C 题意: 有21 个多米诺骨牌,给定一个无向图(无自环,无重边),一条边上可以放一个多米诺骨牌.如果两 ...

  6. Codeforces Round #588 (Div. 2)

    传送门 A. Dawid and Bags of Candies 乱搞. Code #include <bits/stdc++.h> #define MP make_pair #defin ...

  7. codeforces刷题记录

    Codefest 19 (open for everyone, rated, Div. 1 + Div. 2) C. Magic Grid 这种题直接构造 数n是2的n次方的倍数的时候可以这样划分数 ...

  8. BPM Domino集成解决方案

    一.需求分析 Lotus Notes/Domino是IBM的协同办公平台,在国内有广泛的用户. 但由于推出年头较早.采用文档数据库等特点, 导致其流程集成能力弱.统计分析难.不支持移动办公等问题,很多 ...

  9. 【转载】给那些想多学习,多进步的Domino初学者

    在这个社区里面,包括QQ技术群里面混了很久了.遇到了很多Domino初学者,也认识了很多致力于Domino这个技术领域的朋友,很开心.很久没有写长篇大论给大家了.我要把一些想法写出来,共大家参考.讨论 ...

随机推荐

  1. 服务器nginx部署PHP项目样式不出来要注意的小问题

    服务器使用nginx部署PHP项目的时候如果样式没有 出来,那么很可能 location 块里出问题了. 比如 location / { root /home/wwwroot/default/php_ ...

  2. Greenplum table 之 appendonly表

    一.压缩表 1.appendonly压缩表的数据视图为pg_appendonly 2.appendonly在Greenplum后也可更新与删除

  3. SYSTEM_INFORMATION_CLASS

    source: https://github.com/processhacker/processhacker/blob/master/phnt/include/ntexapi.h // rev // ...

  4. 区间连续长度的线段树——洛谷P2894 [USACO08FEB]酒店Hotel

    https://www.luogu.org/problem/P2894 #include<cstdio> #include<iostream> using namespace ...

  5. 【概率论】5-5:负二项分布(The Negative Binomial Distribution)

    title: [概率论]5-5:负二项分布(The Negative Binomial Distribution) categories: - Mathematic - Probability key ...

  6. 去掉 webstorm 灰色的数据类型提示

  7. Java基础系列 - JAVA集合ArrayList,Vector,HashMap,HashTable等使用

    package com.test4; import java.util.*; /** * JAVA集合ArrayList,Vector,HashMap,HashTable等使用 */ public c ...

  8. [提权]CVE-2018-8120漏洞复现

    0x01 漏洞名称 Windows操作系统Win32k的内核提权漏洞 0x02 漏洞编号 CVE-2018-8120 0x03 漏洞描述 部分版本Windows系统win32k.sys组件的NtUse ...

  9. Apache日志详解

    在渗透测试的工作中,WEB网站的日志是非常重要的,今天总结了一些关于调配Apache日志的一些东西. 0x00 Apache日志文件名称及路径介绍 我们安装好Apache后,Apache的配置文件(h ...

  10. ICEM-缺角正方体

    原视频下载地址:https://yunpan.cn/cqKwGiMRiqN7I  访问密码 3377