Gym100623A Access Control Lists
| Gym 100623A | Access Control Lists |


这个题很sb啊,就是去设置个交换机
我们可以给一个IP进行设置,也可以对一个网段就行设置,但是IP是优于网段的,比如样例的第一个
网段是什么呢,就是一个IP+子网掩码,这个IP的前x位2进制位为1,那么IP就是掩码为32
但是样例的问题要解决掉啊,就是先allow再deny也可以的,所以就设置一个标记好了,deny就是负的
非常巧妙地解决了这个问题,dreamoon牛逼
#include<bits/stdc++.h>
using namespace std;
#define ui unsigned int
ui ip;
map<ui,int>H[];
int main()
{
freopen("access.in","r",stdin);
freopen("access.out","w",stdout);
ios::sync_with_stdio(false),cin.tie(),cout.tie();
int n,q;
cin>>n;
string s1,s2,s;
for(int i=,x; i<=n; i++)
{
cin>>s1>>s2>>s;
for(int j=; s[j]; j++)if(s[j]<''||s[j]>'')s[j]=' ';
int tot=,flag,a[];
stringstream ss(s);
while(ss>>a[tot])tot++;
flag=tot>?a[]:,ip=;
for(int j=; j<; j++)ip=ip<<|a[j];
if(!H[flag].count(ip))
{
if(s1[]=='d')H[flag][ip]=-i;
else H[flag][ip]=i;
}
}
cin>>q;
for(int i=,x; i<q; i++)
{
cin>>s;
for(int j=; s[j]; j++)if(s[j]<''||s[j]>'')s[j]=' ';
stringstream ss(s);
ip=;
while(ss>>x)ip=ip<<|x;
int res=;
for(int j=; j>=; j--)
{
if(H[j].count(ip)&&abs(res)>abs(H[j][ip]))res=H[j][ip];
ip^=((ip>>(-j))&)<<(-j);
}
cout<<(res>?'A':'D');
}
return ;
}
Gym100623A Access Control Lists的更多相关文章
- Phalcon 訪问控制列表 ACL(Access Control Lists ACL)
Phalcon在权限方面通过 Phalcon\Acl 提供了一个轻量级的 ACL(訪问控制列表). Access Control Lists (ACL) 同意系统对用户的訪问权限进行控制,比方同意訪问 ...
- [笔记] Access Control Lists (ACL) 学习笔记汇总
一直不太明白Windows的ACL是怎么回事,还是静下心来看一手的MSDN吧. [翻译] Access Control Lists [翻译] How Access Check Works Modify ...
- zookeeper ACL(access control lists)权限控制
基本作用: 针对节点可以设置 相关读写等权限,目的为了保障数据安全性 权限permissions可以制定不同的权限范围以及角色 一:ACL构成 zk的acl ...
- Browser security standards via access control
A computing system is operable to contain a security module within an operating system. This securit ...
- A GUIDE TO UNDERSTANDINGDISCRETIONARY ACCESS CONTROL INTRUSTED SYSTEMS
1. INTRODUCTION The main goal of the National Computer Security Center is to encourage the widespr ...
- Method and system for implementing mandatory file access control in native discretionary access control environments
A method is provided for implementing a mandatory access control model in operating systems which na ...
- Enabling granular discretionary access control for data stored in a cloud computing environment
Enabling discretionary data access control in a cloud computing environment can begin with the obtai ...
- 转:Oracle R12 多组织访问的控制 - MOAC(Multi-Org Access Control)
什么是MOAC MOAC(Multi-Org Access Control)为多组织访问控制,是Oracle EBS R12的重要新功能,它可以实现在一个Responsibility下对多个Opera ...
- Oracle Applications Multiple Organizations Access Control for Custom Code
档 ID 420787.1 White Paper Oracle Applications Multiple Organizations Access Control for Custom Code ...
随机推荐
- innobackupex实现对MySQL的增量备份与还原
备份增量备份是基于完整备份的,所以我们需要先做一次完整备份: innobackupex --defaults-file=/etc/my.cnf --user root --password cheng ...
- 2018.5.30 Oracle数据库PLSQL编程---游标的使用
显示游标的步骤 /* 显示游标处理步骤 1.声明游标 语法结构:cursor 游标名称 is SQL 语句; 2.打开游标 语法结构:open游标名称; 3.提取数据 语法结构:fetch 4.关闭游 ...
- 2018.1.30 PHP编程之验证码
PHP编程之验证码 1.创建验证码函数 验证码函数输入通用函数,将函数放入global.func.php里. //创建一个随机码 for($ i=0;$i<4;$i++){ $_nmsg. = ...
- 重学css3(概览)
css3新特性概览: 1.强大的选择器 2.半透明度效果的实现 3.多栏布局 4.多背景图 5.文字阴影 6.开放字体类型 7.圆角 8.边框图片 9.盒子阴影 10.媒体查询 浏览器内核又可以分成两 ...
- XAMPP安装过程中,出现的问题
这次运行一个简单的前端(html+css+js+ajax)+php后端项目,运行XAMPP的时候,出现两个问题: phpmyadmin运行不起来,一直报1544错误 请求本地图片及php文件报403错 ...
- 【计数】cf938E. Max History
发现有一种奇怪的方法不能快速预处理? 复习一下常见的凑组合数的套路 You are given an array a of length n. We define fa the following w ...
- 正则python正则,提取\t\n里面的大写英文字母
ss = '['\r\n\t\t\t\t\t\t\t\t\t', '\r\n\t\t\t\t\t\t\t', '\r\n\t\t\t\t\t\t\t\t\tCMA CGM JACQUES JOSEPH ...
- 为什么选择Redis
1)Redis不仅仅支持简单的k/v类型的数据,同时还提供list,set,zset,hash等数据结构的存储. 2)Redis支持master-slave(主-从)模式应用 3)Redi ...
- hive的常用HQL语句
1.过滤条件 where .limit. distinct. between and . null. is not nullselect * from emp where sal > 3000; ...
- pandas知识点(处理缺失数据)
pandas使用浮点值NaN表示浮点和非浮点数组中的缺失数据: In [14]: string_data = Series(['aardvark','artichoke',np.nan,'avocad ...