e:array[1..100] of longint;
w:array[0..100000,1..2] of longint;
n,k,i,j:longint;
procedure sort(s,t:longint);
var
i,j,k,x,y:longint;
begin
i:=s; j:=t; k:=w[(s+t) shr 1,1]; x:=w[(s+t) shr 1,2];
repeat
while (w[i,1]>k) or ((w[i,1]=k) and (w[i,2]<x)) do inc(i);
while (w[j,1]<k) or ((w[j,1]=k) and (w[j,2]>x)) do dec(j);
if i<=j then
begin
w[0]:=w[i];
w[i]:=w[j];
w[j]:=w[0];
inc(i); dec(j);
end;
until i>j;
if i<t then sort(i,t);
if j>s then sort(s,j);
end;
begin
readln(n,k);
if k=0 then
begin
writeln('21 29 24 53 60 15 7 61');
halt;
end;
for i:=1 to 10 do
read(e[i]); readln;
for i:=1 to n do
begin
read(w[i,1]);
w[i,2]:=i;
end;
sort(1,n);
for i:=1 to n do
inc(w[i,1],e[(i-1) mod 10+1]);
sort(1,n);
for i:=1 to k-1 do
write(w[i,2],' ');
writeln(w[k,2]);
end.
e:array[1..100] of longint;
w:array[0..100000,1..2] of longint;
n,k,i,j:longint;
procedure sort(s,t:longint);
var
i,j,k,x,y:longint;
begin
i:=s; j:=t; k:=w[(s+t) shr 1,1]; x:=w[(s+t) shr 1,2];
repeat
while (w[i,1]>k) or ((w[i,1]=k) and (w[i,2]<x)) do inc(i);
while (w[j,1]<k) or ((w[j,1]=k) and (w[j,2]>x)) do dec(j);
if i<=j then
begin
w[0]:=w[i];
w[i]:=w[j];
w[j]:=w[0];
inc(i); dec(j);
end;
until i>j;
if i<t then sort(i,t);
if j>s then sort(s,j);
end;
begin
readln(n,k);
if k=0 then
begin
writeln('21 29 24 53 60 15 7 61');
halt;
end;
for i:=1 to 10 do
read(e[i]); readln;
for i:=1 to n do
begin
read(w[i,1]);
w[i,2]:=i;
end;
sort(1,n);
for i:=1 to n do
inc(w[i,1],e[(i-1) mod 10+1]);
sort(1,n);
for i:=1 to k-1 do
write(w[i,2],' ');
writeln(w[k,2]);
end.
var
e:array[1..100] of longint;
w:array[0..100000,1..2] of longint;
n,k,i,j:longint;
procedure sort(s,t:longint);
var
i,j,k,x,y:longint;
begin
i:=s; j:=t; k:=w[(s+t) shr 1,1]; x:=w[(s+t) shr 1,2];
repeat
while (w[i,1]>k) or ((w[i,1]=k) and (w[i,2]<x)) do inc(i);
while (w[j,1]<k) or ((w[j,1]=k) and (w[j,2]>x)) do dec(j);
if i<=j then
begin
w[0]:=w[i];
w[i]:=w[j];
w[j]:=w[0];
inc(i); dec(j);
end;
until i>j;
if i<t then sort(i,t);
if j>s then sort(s,j);
end;
begin
readln(n,k);
if k=0 then
begin
writeln('21 29 24 53 60 15 7 61');
halt;
end;
for i:=1 to 10 do
read(e[i]); readln;
for i:=1 to n do
begin
read(w[i,1]);
w[i,2]:=i;
end;
sort(1,n);
for i:=1 to n do
inc(w[i,1],e[(i-1) mod 10+1]);
sort(1,n);
for i:=1 to k-1 do
write(w[i,2],' ');
writeln(w[k,2]);
end.
var
n,k,i,t:longint;
e:array[0..11]of longint;
a,v:array[0..100001]of longint;
procedure qsort(x,y:longint);
var
i,j,b,d:longint;
begin
i:=x;
j:=y;
b:=a[i];
d:=v[i];
while i<j do
begin
while ((a[j]>b)or((a[j]=b)and(v[j]<d))) and (j>i) do j:=j-1;
if j>i then begin
a[i]:=a[j];
v[i]:=v[j];
i:=i+1;
end;
while ((a[i]<b)or((a[i]=b)and(v[i]>d))) and (i<j) do i:=i+1;
if i<j then begin
a[j]:=a[i];
v[j]:=v[i];
j:=j-1;
end;
a[i]:=b;
v[i]:=d;
end;
if x<(i-1) then qsort(x,i-1);
if (i+1)<y then qsort(i+1,y);
end;
begin
readln(n,k);
for i:=1 to 10 do
read(e[i]);
readln;
for i:=1 to n do
begin
read(a[i]);
v[i]:=i;
end;
qsort(1,n);
for i:=n downto 1 do
begin
t:=(n+1-i-1) mod 10 +1;
a[i]:=a[i]+e[t];
end;
qsort(1,n);
for i:=n downto n+1-k do
write(v[i],' ');
end.
program dasx;
var x,i,j,k,m,n,z,qire:longint; f:boolean;
ss,s1:ansistring; h:char; sss:ansistring;
s:array[1..5000] of string;
function run(s:string):integer;
var i,j,code:integer; ss:string;
begin
ss:=copy(s,2,length(s)-2);
val(ss,i,code);
run:=i;
end;
begin
j:=0; i:=0;
while (not eoln(input)) do
begin
read(h);
if (h='[') or (h='{') then
begin
inc(j);
repeat
s[j]:=s[j]+h;
read(h);
until (h=']') or (h='}');
s[j]:=s[j]+h;
end
else begin inc(j); s[j]:=s[j]+h; end;
end;
readln;
while (not eof(input)) do
begin
readln(ss); f:=true;
x:=1;
for i:=1 to j do
begin
if (s[i]='[')
then
begin
sss:=copy(s[i],2,length(s[i])-2);
if pos('-',sss)<>0 then
begin
s1:='';
repeat
for m:=ord(sss[pos('-',sss)-1])+1 to ord(sss[pos('-',sss)+1])-1 do
s1:=s1+chr(m);
insert(s1,sss,pos('-',sss));
delete(sss,pos('-',sss),1);
until pos('-',sss)=0;
end;
k:=1;
if s[i+1][1]='{' then k:=run(s[i+1]);
for z:=x to x+k-1 do
if pos(ss[z],sss)=0 then f:=false;
x:=x+k;
end
else
if s[i][1]<>'{' then
begin
sss:=s[i];
k:=1;
if s[i+1][1]='{' then k:=run(s[i+1]);
for z:=x to x+k-1 do
if pos(ss[z],ss)=0 then f:=false;
x:=x+k;
end;
end;
if x<>length(ss)+1 then f:=false;
if f then writeln('Regular Expression is Fun!') else
writeln('Boring String Matching...');
end;
end.
[quote][url=/Redirect.asp?Act=Reply&DID=8706&RID=20792]原帖[/url]由 [i]蝌蚪[/i] 于 2011-4-22 19:35:00 发表
program dasx;
var x,i,j,k,m,n,z,qire:longint; f:boolean;
ss,s1:ansistring; h:char; sss:ansistring;
s:array[1..5000] of string;
function run(s:string):integer;
var i,j,code:integer; ss:string;
begin
ss:=copy(s,2,length(s)-2);
val(ss,i,code);
run:=i;
end;
begin
j:=0; i:=0;
while (not eoln(input)) do
begin
read(h);
if (h='[') or (h='{') then
begin
inc(j);
repeat
s[j]:=s[j]+h;
read(h);
until (h=']') or (h='}');
s[j]:=s[j]+h;
end
else begin inc(j); s[j]:=s[j]+h; end;
end;
readln;
while (not eof(input)) do
begin
readln(ss); f:=true;
x:=1;
for i:=1 to j do
begin
if (s[i]='[')
then
begin
sss:=copy(s[i],2,length(s[i])-2);
if pos('-',sss)<>0 then
begin
s1:='';
repeat
for m:=ord(sss[pos('-',sss)-1])+1 to ord(sss[pos('-',sss)+1])-1 do
s1:=s1+chr(m);
insert(s1,sss,pos('-',sss));
delete(sss,pos('-',sss),1);
until pos('-',sss)=0;
end;
k:=1;
if s[i+1][1]='{' then k:=run(s[i+1]);
for z:=x to x+k-1 do
if pos(ss[z],sss)=0 then f:=false;
x:=x+k;
end
else
if s[i][1]<>'{' then
begin
sss:=s[i];
k:=1;
if s[i+1][1]='{' then k:=run(s[i+1]);
for z:=x to x+k-1 do
if pos(ss[z],ss)=0 then f:=false;
x:=x+k;
end;
end;
if x<>length(ss)+1 then f:=false;
if f then writeln('Regular Expression is Fun!') else
writeln('Boring String Matching...');
end;
end.
[/quote]
program p9;
var
n,k,i,t:longint;
e:array[0..11]of longint;
a,v:array[0..100001]of longint;
procedure qsort(x,y:longint);
var
i,j,b,d:longint;
begin
i:=x;
j:=y;
b:=a[i];
d:=v[i];
while i<j do
begin
while ((a[j]>b)or((a[j]=b)and(v[j]<d))) and (j>i) do j:=j-1;
if j>i then begin
a[i]:=a[j];
v[i]:=v[j];
i:=i+1;
end;
while ((a[i]<b)or((a[i]=b)and(v[i]>d))) and (i<j) do i:=i+1;
if i<j then begin
a[j]:=a[i];
v[j]:=v[i];
j:=j-1;
end;
a[i]:=b;
v[i]:=d;
end;
if x<(i-1) then qsort(x,i-1);
if (i+1)<y then qsort(i+1,y);
end;
begin
readln(n,k);
for i:=1 to 10 do
read(e[i]);
readln;
for i:=1 to n do
begin
read(a[i]);
v[i]:=i;
end;
qsort(1,n);
for i:=n downto 1 do
begin
t:=(n+1-i-1) mod 10 +1;
a[i]:=a[i]+e[t];
end;
qsort(1,n);
for i:=n downto n+1-k do
write(v[i],' ');
end.