- 借教室
- 2015-08-02 12:19:36 @
我下载NOIP的数据自己测发现没问题啊,可是Vijos说我WA……
program classroom;
type
tOrder=record
first:int64;
last:int64;
need:int64;
end;
var
limit:array[1..1000001] of int64;
orders:array[1..1000001] of tOrder;
day,size,i:longint;
first,last,mid:longint;
function error(last:integer):boolean;
var
i:longint;
now:int64;
num:array[1..1000001] of int64;
begin
for i:=1 to day+1 do
begin
num[i]:=0;
end;
for i:=1 to last do
begin
inc(num[orders[i].first],orders[i].need);
inc(num[orders[i].last+1],-orders[i].need);
end;
now:=0;
for i:=1 to day do
begin
inc(now,num[i]);
if now>limit[i] then
begin
exit(true);
end;
end;
exit(false);
end;
begin
assign(input,'classroom.in');
reset(input);
assign(output,'classroom.out');
rewrite(output);
readln(day,size);
for i:=1 to day do
begin
read(limit[i]);
end;
readln;
for i:=1 to size do
begin
readln(orders[i].need,orders[i].first,orders[i].last);
end;
first:=1;
last:=size+1;
while first<>last do
begin
mid:=(first+last) div 2;
if error(mid) then
begin
last:=mid;
end
else
begin
first:=mid+1;
end;
end;
if first=size+1 then
begin
writeln(0);
end
else
begin
writeln(-1);
writeln(first);
end;
close(input);
close(output);
end.
6 条评论
-
laosb LV 4 @ 2015-08-08 14:39:02
人群中突然钻出来个光头!WA!
-
2015-08-04 20:22:59@
twd2说得对,你用了文件输入输出啦啦啦~~~
-
2015-08-04 11:12:41@
测试数据 #0: Accepted, time = 15 ms, mem = 39896 KiB, score = 5
测试数据 #1: Accepted, time = 3 ms, mem = 39896 KiB, score = 5
测试数据 #2: Accepted, time = 15 ms, mem = 39896 KiB, score = 5
测试数据 #3: Accepted, time = 1 ms, mem = 39896 KiB, score = 5
测试数据 #4: Accepted, time = 15 ms, mem = 39900 KiB, score = 5
测试数据 #5: Accepted, time = 1 ms, mem = 39900 KiB, score = 5
测试数据 #6: WrongAnswer, time = 187 ms, mem = 39896 KiB, score = 0
测试数据 #7: WrongAnswer, time = 203 ms, mem = 39896 KiB, score = 0
测试数据 #8: WrongAnswer, time = 187 ms, mem = 39900 KiB, score = 0
测试数据 #9: WrongAnswer, time = 187 ms, mem = 39896 KiB, score = 0
测试数据 #10: WrongAnswer, time = 187 ms, mem = 39900 KiB, score = 0
测试数据 #11: WrongAnswer, time = 187 ms, mem = 39896 KiB, score = 0
测试数据 #12: Accepted, time = 187 ms, mem = 39896 KiB, score = 5
测试数据 #13: WrongAnswer, time = 187 ms, mem = 39896 KiB, score = 0
测试数据 #14: WrongAnswer, time = 1937 ms, mem = 39896 KiB, score = 0
测试数据 #15: WrongAnswer, time = 1640 ms, mem = 39900 KiB, score = 0
测试数据 #16: WrongAnswer, time = 1968 ms, mem = 39896 KiB, score = 0
测试数据 #17: WrongAnswer, time = 1234 ms, mem = 39896 KiB, score = 0
测试数据 #18: WrongAnswer, time = 1406 ms, mem = 39896 KiB, score = 0
测试数据 #19: WrongAnswer, time = 1421 ms, mem = 39896 KiB, score = 0 -
2015-08-04 11:11:57@
把交题记录发一下
-
2015-08-03 11:34:18@
我本来没有用,后来自己下载NOIP数据测的时候才改成文件的
-
2015-08-03 05:50:30@
我不懂Pascal TAT 你是不是用了文件输入输出
- 1