Codeforces 1229A. Marcin and Training Camp
垃圾翻译毁一生怎么办
题目看错直接 $GG$
首先所有 $a_i$ 重复出现的人全都可以加入
考虑剩下的人发现 $a$ 必须是初始那些人的子集才能加入(证明显然),设当前考虑的人为 $x$
则集合存在 $y$ ,使得 $a_y>a_x$ 并且 $a_y \text{&} a_x=a_x$
证明显然...真的很显然啊
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<map>
#include<vector>
using namespace std;
typedef long long ll;
inline ll read()
{
ll x=,f=; char ch=getchar();
while(ch<''||ch>'') { if(ch=='-') f=-; ch=getchar(); }
while(ch>=''&&ch<='') { x=(x<<)+(x<<)+(ch^); ch=getchar(); }
return x*f;
}
const int N=;
const ll INF=1e18;
ll n,a[N],b[N];
ll Ans;
vector <int> V;
map <ll,int> cnt;
bool vis[N];
int main()
{
n=read(); if(n==) { printf("0\n"); return ; }
for(int i=;i<=n;i++) a[i]=read(),cnt[a[i]]++;
for(int i=;i<=n;i++) b[i]=read();
for(int i=;i<=n;i++) if(cnt[a[i]]>) V.push_back(i),vis[i]=;
for(int i=;i<=n;i++)
{
if(vis[i]) continue;
for(auto A: V) if(a[A]>a[i]&&((a[A]&a[i])==a[i])) { V.push_back(i),vis[i]=; break; }
}
for(auto A: V) Ans+=b[A];
printf("%lld\n",Ans);
return ;
}
Codeforces 1229A. Marcin and Training Camp的更多相关文章
- D. Marcin and Training Camp
D. Marcin and Training Camp 题目链接:http://codeforces.com/contest/1230/problem/D time limit per test: 3 ...
- Marcin and Training Camp
D. Marcin and Training Camp 参考:D. Marcin and Training Camp 思路:首先先确定最大成员的\(a_i\),因为不能够某个成员i认为自己比其他所有成 ...
- Codeforces Round #588 (Div. 2) D. Marcin and Training Camp(思维)
链接: https://codeforces.com/contest/1230/problem/D 题意: Marcin is a coach in his university. There are ...
- 【CF1210B】Marcin and Training Camp(贪心)
题意:有n个人,60种技能点,如果第i个人会第j种技能a[i]的二进制表示的第j位就是1,第i个人的价值是b[i] 如果有若干种技能i会j不会,i就会鄙视j 求一种至少两个人的选人方案使得价值和最大, ...
- Petrozavodsk Summer Training Camp 2017 Day 9
Petrozavodsk Summer Training Camp 2017 Day 9 Problem A. Building 题目描述:给出一棵树,在树上取出一条简单路径,使得该路径的最长上升子序 ...
- 2016 Al-Baath University Training Camp Contest-1
2016 Al-Baath University Training Camp Contest-1 A题:http://codeforces.com/gym/101028/problem/A 题意:比赛 ...
- 2015 UESTC Winter Training #7【2010-2011 Petrozavodsk Winter Training Camp, Saratov State U Contest】
2015 UESTC Winter Training #7 2010-2011 Petrozavodsk Winter Training Camp, Saratov State U Contest 据 ...
- 2015-2016 Petrozavodsk Winter Training Camp, Nizhny Novgorod SU Contest (5/9)
2015-2016 Petrozavodsk Winter Training Camp, Nizhny Novgorod SU Contest B. Forcefield 题意 给你一维平面上n个镜子 ...
- Petrozavodsk Summer Training Camp 2017
Petrozavodsk Summer Training Camp 2017 Problem A. Connectivity 题目描述:有\(n\)个点,现不断地加边.每条边有一种颜色,如果一个点对\ ...
随机推荐
- python中的定时器threading.Timer
由浅入深学SQL Server 2012 --> python开发中用到,定时操作.例如每隔1s执行一次,发现 threading.Timer,这个东西,可以直接用. 其原理为执行函数中置定时 ...
- LeetCode 105. 从前序与中序遍历序列构造二叉树(Construct Binary Tree from Preorder and Inorder Traversal)
题目描述 根据一棵树的前序遍历与中序遍历构造二叉树. 注意:你可以假设树中没有重复的元素. 例如,给出 前序遍历 preorder = [3,9,20,15,7] 中序遍历 inorder = [9, ...
- How to change the button text of <input type=“file” />?
How to change the button text of <input type=“file” />? Simply <label class="btn btn-p ...
- Nexus3.x帐号权限配置
一.使用admin登录后,点击上方齿轮图标 二.打开左侧导航,Security Privileges:具体的权限明细,比如我创建一个test仓库,这里就会生成 Roles:添加角色,设置每个角色可看到 ...
- koa 基础(七)错误处理中间件
1.错误处理中间件 app.js /** * 错误处理中间件 */ // 引入模块 const Koa = require('koa'); const router = require('koa-ro ...
- VI快捷键速记
enjoy :P
- windows客户端如果通过cmd窗口连接到远程linux服务器,可以使用telnet;
linux系统打开telnet端口的方法 2016-03-11 16:02:25 标签:linux telnet 原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明. ...
- Anaconda安装pygame
注:安装任何库前,都先更新下pip版本 python -m pip install --upgrade pip 安装pygame : pip install pygame
- vue中局部封装axios
Vue中局部配置axios 'use strict' import axios from 'axios'; import { Loading } from 'element-ui'; export c ...
- linux中配置双网卡的目的?如何实现双网卡绑定,以实现负载均衡?
配置双网卡的目的:========================== 1.你想做路由器,网关 2.实现冗余 3.负载均衡 linux 主机安装双网卡,共享一个IP地址,对外提供访问,实际 同 ...