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的更多相关文章

  1. Phalcon 訪问控制列表 ACL(Access Control Lists ACL)

    Phalcon在权限方面通过 Phalcon\Acl 提供了一个轻量级的 ACL(訪问控制列表). Access Control Lists (ACL) 同意系统对用户的訪问权限进行控制,比方同意訪问 ...

  2. [笔记] Access Control Lists (ACL) 学习笔记汇总

    一直不太明白Windows的ACL是怎么回事,还是静下心来看一手的MSDN吧. [翻译] Access Control Lists [翻译] How Access Check Works Modify ...

  3. zookeeper ACL(access control lists)权限控制

    基本作用:        针对节点可以设置 相关读写等权限,目的为了保障数据安全性        权限permissions可以制定不同的权限范围以及角色 一:ACL构成         zk的acl ...

  4. Browser security standards via access control

    A computing system is operable to contain a security module within an operating system. This securit ...

  5. A GUIDE TO UNDERSTANDINGDISCRETIONARY ACCESS CONTROL INTRUSTED SYSTEMS

    1. INTRODUCTION   The main goal of the National Computer Security Center is to encourage the widespr ...

  6. 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 ...

  7. 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 ...

  8. 转:Oracle R12 多组织访问的控制 - MOAC(Multi-Org Access Control)

    什么是MOAC MOAC(Multi-Org Access Control)为多组织访问控制,是Oracle EBS R12的重要新功能,它可以实现在一个Responsibility下对多个Opera ...

  9. Oracle Applications Multiple Organizations Access Control for Custom Code

    档 ID 420787.1 White Paper Oracle Applications Multiple Organizations Access Control for Custom Code ...

随机推荐

  1. IOS 绘制画画板(封装上下文)

    封装上下文 UIImage (CaptureView).h / .m @interface UIImage (CaptureView) + (UIImage *)captureImageWithVie ...

  2. IOS tableView 去除分割线 和 不允许选中表格cell

    //去除分割线 self.tableView.backgroundColor=[UIColor colorWithRed:///255.0 alpha:1.0]; self.tableView.sep ...

  3. Problem K: 搜索基础之棋盘问题

    Problem K: 搜索基础之棋盘问题 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 92  Solved: 53[Submit][Status][W ...

  4. js当中mouseover和mouseout多次触发(非冒泡)

    JS当中,mouseover和mouseout多次触发事件,不光是冒泡会产生,就是不冒泡,在一定条件下 ,也会产生多次触发事件: 例如下面的结构的情况下,我在class="ceng_up f ...

  5. 按格式读取csv文件内容

    string path = @"C:\Users\keen_\Downloads\upload\upload\Upload\20140701141934_export.csv"; ...

  6. Express框架 --router/app.use

    翻看去年自己记录的印象笔记,准备把笔记上的一些内容也同时更新到博客上,方便自己查看. 1.app.use和app.get的区别及解析 app.use(path,callback)中的callback既 ...

  7. Django项目中"expected str, bytes or os.PathLike object, not list"错误解决:

    对于这个错误,也在于自己对django基础的掌握不是很牢固,忽略了MEDIA_ROOT的类型是string,而不是list. 错误的写法: MEDIA_ROOT = [ os.path.join(BA ...

  8. 抽屉head部分,hover应用,鼠标放上变色

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  9. Mybatis 插入一条或批量插入 返回带有自增长主键记录

    首先讲一下,  插入一条记录返回主键的 Mybatis 版本要求低点,而批量插入返回带主键的 需要升级到3.3.1版本,3.3.0之前的都不行, <dependency> <grou ...

  10. 震惊!几道Python 理论面试题,Python面试题No18

    本面试题题库,由公号:非本科程序员 整理发布 第1题: 简述解释型和编译型编程语言? 解释型语言编写的程序不需要编译,在执行的时候,专门有一个解释器能够将VB语言翻译成机器语言,每个语句都是执行的时候 ...