社区讨论
为什么程序不能从洛谷上通过?
P2114[NOI2014] 起床困难综合症参与者 6已保存回复 6
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 6 条
- 当前快照
- 1 份
- 快照标识符
- @mi4g7n62
- 此快照首次捕获于
- 2025/11/18 18:46 4 个月前
- 此快照最后确认于
- 2025/11/18 18:46 4 个月前
从bzoj上过了但是在洛谷上只能过3个点,其他超时。
是不是有些地方需要特别注意?
CPP[codep]program p2114;
var n,m,now,max,min,po,i:longint;
mt,st,bt:array[1..33] of boolean;
s:ansistring;
begin
fillchar(mt,sizeof(mt),false);
fillchar(st,sizeof(st),false);
readln(n,m);
min:=0;
for i:=1 to 31 do
if ((1 shl i)-1)>=m then break;
max:=(1 shl i)-1;
for i:=1 to n do
begin
readln(s);
if s[1]='A' then
begin
val(copy(s,5,length(s)-4),now,po);
max:=max and now;
min:=min and now;
end
else
if s[1]='O' then
begin
val(copy(s,4,length(s)-3),now,po);
max:=max or now;
min:=min or now;
end
else
if s[1]='X' then
begin
val(copy(s,5,length(s)-4),now,po);
max:=max xor now;
min:=min xor now;
end;
end;
for i:=0 to 30 do
begin
if (max and (1 shl i))<>0 then mt[i+1]:=true;
if (min and (1 shl i))<>0 then st[i+1]:=true;
end;
now:=0;
po:=0;
for i:=31 downto 1 do
if st[i] then now:=now+(1 shl(i-1))
else
if (mt[i])and((po+(1 shl(i-1)))<=m) then
begin now:=now+(1 shl(i-1));po:=po+(1 shl(i-1));end;
writeln(now);
end.[/codep]
回复
共 6 条回复,欢迎继续交流。
正在加载回复...