CF1210A Anadi and Domino
思路:
很有意思的思维题。
实现:
#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的更多相关文章
- C. Anadi and Domino
题目链接:http://codeforces.com/contest/1230/problem/C C. Anadi and Domino time limit per test: 2 seconds ...
- 588 div2 C. Anadi and Domino
C. Anadi and Domino 题目链接:https://codeforces.com/contest/1230/problem/C Anadi has a set of dominoes. ...
- Anadi and Domino
C - Anadi and Domino 参考:Anadi and Domino 思路:分为两种情况: ①n<=6,这个时候肯定可以保证降所有的边都放上一张多米诺牌,那么答案就是m ②n==7, ...
- 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 ...
- cf-1230C Anadi and Domino
题目链接:http://codeforces.com/contest/1230/problem/C 题意: 有21 个多米诺骨牌,给定一个无向图(无自环,无重边),一条边上可以放一个多米诺骨牌.如果两 ...
- Codeforces Round #588 (Div. 2)
传送门 A. Dawid and Bags of Candies 乱搞. Code #include <bits/stdc++.h> #define MP make_pair #defin ...
- codeforces刷题记录
Codefest 19 (open for everyone, rated, Div. 1 + Div. 2) C. Magic Grid 这种题直接构造 数n是2的n次方的倍数的时候可以这样划分数 ...
- BPM Domino集成解决方案
一.需求分析 Lotus Notes/Domino是IBM的协同办公平台,在国内有广泛的用户. 但由于推出年头较早.采用文档数据库等特点, 导致其流程集成能力弱.统计分析难.不支持移动办公等问题,很多 ...
- 【转载】给那些想多学习,多进步的Domino初学者
在这个社区里面,包括QQ技术群里面混了很久了.遇到了很多Domino初学者,也认识了很多致力于Domino这个技术领域的朋友,很开心.很久没有写长篇大论给大家了.我要把一些想法写出来,共大家参考.讨论 ...
随机推荐
- 使用jQuery快速高效制作网页交互特效-----JavaScript操作DOM对象
一.DOM操作分类 使用JavaScript操作DOM时通常分为三类:DOM Core.HTMl--DOM和CSS-DOM 二.访问节点 节点属性 三.节点信息 四.操作节点的属性 语法: ge ...
- 自定义starter
https://github.com/deadzq/spring-boot-starter-hello 父子项目 子项目引用父项目中的依赖和配置参数
- Luogu5071 [Ynoi2015]此时此刻的光辉 【莫队】
题目链接:洛谷 这个跟上上个Ynoi题目是一样的套路,首先我们知道\(n=\prod p_i^{\alpha_i}\)时\(d(n)=\prod (\alpha_i+1)\). 首先对所有数分解质因数 ...
- Mysql数据库简单使用(二)
Mysql导入.sql文件 进入数据库(要导入的数据库) 数据库中有要导入.sql文件名的数据库,没有则新建. source 路径+文件名 souce /home/robot/csql.sql 数据库 ...
- 10月清北学堂培训 Day 3
今天是钟皓曦老师的讲授~ zhx:题很简单,就是恶心一些qwq~ T1 别人只删去一个字符都能AC,我双哈希+并查集只有40?我太菜了啊qwq 考虑到越短的字符串越难压缩,越长的字符串越好压缩,所以我 ...
- c++中的new的应用
代码如下: #include <cstddef> #include <iostream> using namespace std; class CTest{ public: ; ...
- onPageScroll的使用
1. 2.
- Multiple commands produce "*.framework"
参考链接记录个问题,这是xcode10后新build系统导致的,新系统帮我们检查了很多东西,最优化我们的构建, 两种方案 1.用旧的系统(不推荐) 2.这个是build setting->b ...
- TortoiseGit的安装与配置
1. 简介 TortoiseGit是Tortoise提供的Git版本可视化工具,简化Git记忆命令行的过程,将命令行可视化. 2. 下载 官网:https://tortoisegit.org/down ...
- java定时案例
好久没写笔记了,变懒了! java定时运行的三个案例: 一, 通过sleep方法来达到定时任务的效果 public class testTime { public static void main(S ...