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. HTML5新特性 video '&#x25BA'

    var play = document.createElement('button') play.setAttribute('title','play') play.innerHTML = '►' 创 ...

  2. UVA 1642 Magical GCD(gcd的性质,递推)

    分析:对于区间[i,j],枚举j. 固定j以后,剩下的要比较M_gcd(k,j) = gcd(ak,...,aj)*(j-k+1)的大小, i≤k≤j. 此时M_gcd(k,j)可以看成一个二元组(g ...

  3. Android(java)学习笔记80:Html嵌入到Java显示乱码

    1. Html嵌入到Java显示乱码: 解决方案: 使用 loadData方法是中文部分会出现乱码,即使指定“utf-8”.“gbk”.“gb2312”也一样. webView.getSettings ...

  4. NOIP2018提高组Day2 解题报告

    前言 关于\(NOIP2018\),详见此博客:NOIP2018学军中学游记(11.09~11.11). \(Day2\)的题目和\(Day1\)比起来,真的是难了很多啊. \(T1\):旅行(点此看 ...

  5. 实现带复选框的TreeView控件

    实现效果: 知识运用: TreeView控件的CheckView属性 //是否在树形视图控件中显示复选框 public bool CheckBoxs{ get;ser } 实现代码: TreeView ...

  6. 求和VII

    问题 K: 求和VII 时间限制: 2 Sec  内存限制: 256 MB提交: 422  解决: 53[提交] [状态] [讨论版] [命题人:admin] 题目描述 master对树上的求和非常感 ...

  7. 2017.12.13 Java中是怎样通过类名,创建一个这个类的数组

    先在类方法中定义数组的方法: public int[] method6(int[] arr){ for(int i = 0; i<arr.length;i++){ arr[i] = (int)( ...

  8. python_69_内置函数1

    #abs()取绝对值 ''' all(iterable) Return True if all elements of the iterable are true (or if the iterabl ...

  9. Maven父子模块引入依赖问题

    公共模块如何放到父pom中,而子pom无需再次引入???

  10. Webpack机制、原理简单小结

    一.webpack的构成 entry  代表项目的入口 module  开发中,每一个文件可以看作一个module chunk  代码块 loader  模块转化器 plugin  扩展插件,自定义w ...