dangerous

1149 Dangerous Goods Packaging

不问归期 提交于 2020-01-31 21:46:01
题目 tip:map+状态记录 题意: 给出n个相违规的物品,以及m组查询,m组查询中每中种查询含有k个物品,问这些物品是否能合法的放在一起 #include<iostream> #include<map> #include<vector> #include<algorithm> using namespace std; int main() { int n,m; cin>>n>>m; map<int ,vector<int>> ans;//违规名单 for(int i=0; i<n; ++i) { int a,b; cin>>a>>b; ans[a].push_back(b); ans[b].push_back(a); } for(int i=0; i<m; ++i) { int checked[100003]= {0};//当前查询序列中是否出现过违规物品 int k,flag=0; cin>>k; for(int j=0; j<k; ++j) { int num; cin>>num; if(checked[num]==-1)//若之前出现与当前产品相违规直接标记当前查询序列不合法 flag=1; if(ans.find(num)!=ans.end()) { for(auto it : ans[num]) { checked[it]=-1;//将于该产品违规的所有产品全标记为

G - Most Dangerous Shark dp 单调栈 单调队列

孤街醉人 提交于 2020-01-26 15:53:17
题意: 一条线段上有n张骨牌(n=1e7), 相邻骨牌距离为1,每张骨牌有其高度和推倒的花费,问最少的花费推倒所有的骨牌。 题解: 首先用单调栈维护每个位置往左(右)推能推倒的最远的骨牌 dp[i]表示1-i倒下的最小花费 转移显然只有两种 一种是第i张往左推动 另一种是找到往右推动能推倒i的最小花费的地方进行转移 这里可以用单调栈维护最小值 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=1e7+1000; ll n,m,siz[N],h[N],L[N],R[N],c[N],dp[N]; vector<ll>H[N],C[N]; int s[N],r; int main() { cin>>n>>m; for(int i=1;i<=n;i++) { scanf("%lld",&siz[i]); H[i].resize(siz[i]); C[i].resize(siz[i]); for(int j=0;j<siz[i];j++) scanf("%lld",&H[i][j]); for(int j=0;j<siz[i];j++) scanf("%lld",&C[i][j]); } int Q;cin>>Q; int cnt=0; while(Q--) { int id,mul

Customizing “A potentially dangerous Request.Path value was detected” error page

匿名 (未验证) 提交于 2019-12-03 08:44:33
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: When I call a page with a non authorized character (such as *), i get a yellow page "A potentially dangerous Request.Path value was detected". It looks like it is a 400 error page. My goal is to customize this page and show a clean error page or redirect to home page (i tried both solutions). Here is what i wrote in my web.config: <system.webServer> <httpErrors errorMode="Custom"> <remove statusCode="400" subStatusCode="-1" /> <remove statusCode="404" subStatusCode="-1" /> <error statusCode="400" path="/page-non-trouvee.aspx?status=400"

Is it really dangerous to save hashed password in cookies?

匿名 (未验证) 提交于 2019-12-03 03:03:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: There are many discussions about security risk for saving hash password in cookies, as upon accessing to the user's computer, a hacker can log in with the saved password. If a hacker has access to the user's computer, he can catch the password, as browsers also save passwords locally (encrypted of course). What is the difference between password set in cookies with that saved by the browser? For obvious reason, a temporary GUID should be send instead of password. In any case, I believe that limiting access to the logged IP can

PHP: How To Disable Dangerous Functions

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How can I disable the dangerous eval function? Can that be done using ini_set function? Also how to disable following functions? Can we disable them using ini_set function? allow_url_fopen allow_url_include exec shell_exec system passthru popen stream_select eval is one of the most dangerous function that bad guys can use to exploit the things. There should be a mechanism to disable that without resorting to php.ini file; but is should be done programatically. Well, guys I am looking for an answers suggesting disabling of these dangerous

MVC3 C# Potentially dangerous request error

匿名 (未验证) 提交于 2019-12-03 01:04:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have an MVC3 C#. Web App. One of our properties uses an RTF control for our TextBoxFor controls: @Html.TextAreaFor(model => model.SowDescription, (object)new { rows = 7, cols = 65, @class = "celltext2 save-alert attachmentEditor", disabled = "disabled" } THe attachmentEditor class uses CkEditor. So there are html tags embedded in the control for Bold, Italics, etc. A user pasted some data into this TextArea and we received this error: A potentially dangerous Request.Form value was detected from the client (SowDescription="<br /> <br /> <u>

LightOJ 1027 A Dangerous Maze (期望)

二次信任 提交于 2019-12-01 07:20:59
题目链接: LightOJ - 1027 Description You are in a maze; seeing \(n\) doors in front of you in beginning. You can choose any door you like. The probability for choosing a door is equal for all doors. If you choose the \(i^{th}\) door, it can either take you back to the same position where you begun in \(x_i\) minutes, or can take you out of the maze after \(x_i\) minutes. If you come back to the same position, you can't remember anything. So, every time you come to the beginning position, you have no past experience. Now you want to find the expected time to get out of the maze. Input Input starts

lightoj 1027 A Dangerous Maze 期望

戏子无情 提交于 2019-11-28 14:01:07
设答案为r,cnt为x[i] >=0的个数 那么r = 1/n * (Σx[i](x[i] >= 0) + ∑(r - x[i])(x[i] < 0)) 然后把r移项到一起解方程, 得到r = ∑|x[i]| / cnt,同除gcd。记得特判下x[i]均为负数的情况即可。 1 #include <cstdio> 2 #include <algorithm> 3 using namespace std; 4 int T,cas,n,tot,gcd,cnt; 5 int x[110]; 6 int main() 7 { 8 for (scanf("%d",&T);T != 0;T--) 9 { 10 cas++; 11 tot = cnt = 0; 12 scanf("%d",&n); 13 for (int i = 1;i <= n;i++) 14 { 15 scanf("%d",&x[i]); 16 if (x[i] >= 0) 17 { 18 cnt++; 19 tot += x[i]; 20 }else 21 tot -= x[i]; 22 } 23 if (cnt == 0) 24 { 25 printf("Case %d: inf\n",cas); 26 continue; 27 } 28 gcd = __gcd(tot,cnt); 29 printf("Case %d: