MM们谁能帮忙提供一下sgu 199 beautiful people 的测试数据?oi 竞赛,帮下忙,
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/07 19:18:14
MM们谁能帮忙提供一下sgu 199 beautiful people 的测试数据?oi 竞赛,帮下忙,
MM们谁能帮忙提供一下sgu 199 beautiful people 的测试数据?
oi 竞赛,帮下忙,
MM们谁能帮忙提供一下sgu 199 beautiful people 的测试数据?oi 竞赛,帮下忙,
Const
InFile = 'p199.in';
OutFile = 'p199.out';
Limit = 100000;
Type
Tpoint = record
x , y , num , father : longint;
end;
Tdata = array[1..Limit] of Tpoint;
Tposition = array[1..Limit] of longint;
Var
data : Tdata;
position ,
num : Tposition;
N , answer : longint;
procedure init;
var
i : longint;
begin
// assign(INPUT , InFile); ReSet(INPUT);
read(N);
for i := 1 to N do
begin
read(data[i].x , data[i].y);
data[i].num := i;
end;
// Close(INPUT);
end;
procedure qk_pass(start , stop : longint; var mid : longint);
var
tmp : longint;
key : Tpoint;
begin
tmp := random(stop - start + 1) + start;
key := data[tmp]; data[tmp] := data[start];
while start < stop do
begin
while (start < stop) and ((data[stop].x > key.x) or (data[stop].x = key.x) and (data[stop].y < key.y)) do dec(stop);
data[start] := data[stop];
if start < stop then inc(start);
while (start < stop) and ((data[start].x < key.x) or (data[start].x = key.x) and (data[start].y > key.y)) do inc(start);
data[stop] := data[start];
if start < stop then dec(stop);
end;
mid := start;
data[start] := key;
end;
procedure qk_sort(start , stop : longint);
var
mid : longint;
begin
if start < stop then
begin
qk_pass(start , stop , mid);
qk_sort(start , mid - 1);
qk_sort(mid + 1 , stop);
end;
end;
function binary_search(y : longint) : longint;
var
st , ed ,
mid : longint;
begin
binary_search := 0;
st := 1; ed := answer;
while st data[i].y then
begin
num[step] := i;
position[step] := data[i].y;
end;
end;
end;
procedure out;
var
i , p : longint;
begin
// assign(OUTPUT , OutFile); ReWrite(OUTPUT);
writeln(answer);
p := num[answer];
for i := 1 to answer do
begin
write(data[p].num);
p := data[p].father;
if i = answer
then writeln
else write(' ');
end;
// Close(OUTPUT);
end;
Begin
init;
work;
out;
End.
你可以随机生成一些数据和这个程序对照
这个是AC的程序