1. uses math;
2. const
3. fi='';
4. fo='';
5. maxn=trunc(1e5);
6. maxk=50;
7. base=790972;
8. var
9. f : array[0..maxn,0..maxk] of int64;
10. i,j,n,k,m : longint;
11. kq : int64;
12. a,b : array[1..maxn] of longint;
13. procedure enter;
14. begin
15. assign(input,fi);reset(input);
17. for i:=1 to n do read(a[i],b[i]);
18. close(input);
19. end;
20. procedure swap(var x,y: longint);
21. var tg : longint;
22. begin
23. tg:=x;x:=y;y:=tg;
24. end;
25. procedure qs(l,r : longint);
26. var i,j,x : longint;
27. begin
28. i:=l;j:=r;
29. x:=b[(l+r) div 2];
30. repeat
31. while x>b[i] do inc(i);
32. while x<b[j] do dec(j);
33. if i<=j then
34. begin
35. swap(b[i],b[j]);
36. swap(a[i],a[j]);
37. inc(i);dec(j);
38. end;
39. until i>j;
40. if i<r then qs(i,r);
41. if j>l then qs(l,j);
42. end;
43. function muk(x : longint) : int64;
44. var i : longint;
45. begin
46. muk := 1;
47. for i:=1 to k do muk:=muk*x;
48. end;
49. function cnk(n,k : longint) : int64;
50. begin
51. cnk := 1;
52. for i:=n-k+1 to n do cnk := cnk*i;
53. for i:=1 to k do cnk := cnk div i;
54. end;
55. function tinh : int64;
56. begin
57. fillchar(f,sizeof(f),0);
58. for i:=0 to m do f[i,0] := 1;
59. for i:=1 to m do
60. for j:=1 to min(k,i) do
61. f[i,j] := (f[i-1,j] + f[i-1,j-1]*a[i]) mod base;
62. exit(f[m,k]);
63. end;
64. procedure process;
65. var i,j,dem : longint;
66. dau,cuoi : longint;
67. begin
68. qs(1,n);
69. m := n;
70. kq := tinh;
71. dau := 1;
72. while (dau<=n) do
73. begin
74. cuoi := dau+1;
75. m := 1; a[1] := a[dau];
76. while (cuoi<=n) and (b[cuoi]=b[dau]) do
77. begin
78. m := m+1;
79. a[m] := a[cuoi];
80. inc(cuoi);
81. end;
82. if cuoi-dau>=k then
83. kq := (kq - tinh + base + base) mod base;
84. dau := cuoi;
85. end;
86. end;
87. procedure print;
88. begin
89. assign(output,fo);rewrite(output);
90. writeln(kq);
91. close(output);
92. end;
93. begin
94. enter;
95. process;
96. print;
97. end.
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:3:6: error: empty character constant
fi='';
^~
prog.cpp:4:6: error: empty character constant
fo='';
^~
prog.cpp:9:13: error: too many decimal points in number
f : array[0..maxn,0..maxk] of int64;
^~~~~~~
prog.cpp:9:21: error: too many decimal points in number
f : array[0..maxn,0..maxk] of int64;
^~~~~~~
prog.cpp:12:15: error: too many decimal points in number
a,b : array[1..maxn] of longint;
^~~~~~~
prog.cpp:1:1: error: ‘uses’ does not name a type
uses math;
^~~~
prog.cpp:3:3: error: ‘fi’ does not name a type
fi='';
^~
prog.cpp:4:3: error: ‘fo’ does not name a type
fo='';
^~
prog.cpp:5:3: error: ‘maxn’ does not name a type
maxn=trunc(1e5);
^~~~
prog.cpp:6:3: error: ‘maxk’ does not name a type
maxk=50;
^~~~
prog.cpp:7:3: error: ‘base’ does not name a type
base=790972;
^~~~
prog.cpp:8:1: error: ‘var’ does not name a type
var
^~~
prog.cpp:10:3: error: ‘i’ does not name a type
i,j,n,k,m : longint;
^
prog.cpp:11:6: error: found ‘:’ in nested-name-specifier, expected ‘::’
kq : int64;
^
prog.cpp:11:3: error: ‘kq’ does not name a type
kq : int64;
^~
prog.cpp:12:3: error: ‘a’ does not name a type
a,b : array[1..maxn] of longint;
^
prog.cpp:13:1: error: ‘procedure’ does not name a type
procedure enter;
^~~~~~~~~
prog.cpp:14:1: error: ‘begin’ does not name a type
begin
^~~~~
prog.cpp:15:25: error: expected constructor, destructor, or type conversion before ‘(’ token
assign(input,fi);reset(input);
^
prog.cpp:16:9: error: expected constructor, destructor, or type conversion before ‘(’ token
^
prog.cpp:17:3: error: expected unqualified-id before ‘for’
for i:=1 to n do read(a[i],b[i]);
^~~
prog.cpp:18:8: error: expected constructor, destructor, or type conversion before ‘(’ token
close(input);
^
prog.cpp:19:1: error: ‘end’ does not name a type
end;
^~~
prog.cpp:20:1: error: ‘procedure’ does not name a type
procedure swap(var x,y: longint);
^~~~~~~~~
prog.cpp:21:1: error: ‘var’ does not name a type
var tg : longint;
^~~
prog.cpp:22:1: error: ‘begin’ does not name a type
begin
^~~~~
prog.cpp:23:9: error: ‘x’ does not name a type
tg:=x;x:=y;y:=tg;
^
prog.cpp:23:14: error: ‘y’ does not name a type
tg:=x;x:=y;y:=tg;
^
prog.cpp:24:1: error: ‘end’ does not name a type
end;
^~~
prog.cpp:25:1: error: ‘procedure’ does not name a type
procedure qs(l,r : longint);
^~~~~~~~~
prog.cpp:26:3: error: ‘var’ does not name a type
var i,j,x : longint;
^~~
prog.cpp:27:3: error: ‘begin’ does not name a type
begin
^~~~~
prog.cpp:28:10: error: ‘j’ does not name a type
i:=l;j:=r;
^
prog.cpp:29:5: error: ‘x’ does not name a type
x:=b[(l+r) div 2];
^
prog.cpp:30:5: error: ‘repeat’ does not name a type
repeat
^~~~~~
prog.cpp:32:7: error: expected unqualified-id before ‘while’
while x<b[j] do dec(j);
^~~~~
prog.cpp:33:7: error: expected unqualified-id before ‘if’
if i<=j then
^~
prog.cpp:36:15: error: expected constructor, destructor, or type conversion before ‘(’ token
swap(a[i],a[j]);
^
prog.cpp:37:14: error: expected constructor, destructor, or type conversion before ‘(’ token
inc(i);dec(j);
^
prog.cpp:37:21: error: expected constructor, destructor, or type conversion before ‘(’ token
inc(i);dec(j);
^
prog.cpp:38:9: error: ‘end’ does not name a type
end;
^~~
prog.cpp:39:5: error: ‘until’ does not name a type
until i>j;
^~~~~
prog.cpp:40:5: error: expected unqualified-id before ‘if’
if i<r then qs(i,r);
^~
prog.cpp:41:5: error: expected unqualified-id before ‘if’
if j>l then qs(l,j);
^~
prog.cpp:42:3: error: ‘end’ does not name a type
end;
^~~
prog.cpp:43:1: error: ‘function’ does not name a type
function muk(x : longint) : int64;
^~~~~~~~
prog.cpp:44:3: error: ‘var’ does not name a type
var i : longint;
^~~
prog.cpp:45:3: error: ‘begin’ does not name a type
begin
^~~~~
prog.cpp:47:5: error: expected unqualified-id before ‘for’
for i:=1 to k do muk:=muk*x;
^~~
prog.cpp:48:3: error: ‘end’ does not name a type
end;
^~~
prog.cpp:49:1: error: ‘function’ does not name a type
function cnk(n,k : longint) : int64;
^~~~~~~~
prog.cpp:50:3: error: ‘begin’ does not name a type
begin
^~~~~
prog.cpp:52:5: error: expected unqualified-id before ‘for’
for i:=n-k+1 to n do cnk := cnk*i;
^~~
prog.cpp:53:5: error: expected unqualified-id before ‘for’
for i:=1 to k do cnk := cnk div i;
^~~
prog.cpp:54:3: error: ‘end’ does not name a type
end;
^~~
prog.cpp:55:1: error: ‘function’ does not name a type
function tinh : int64;
^~~~~~~~
prog.cpp:56:1: error: ‘begin’ does not name a type
begin
^~~~~
prog.cpp:58:3: error: expected unqualified-id before ‘for’
for i:=0 to m do f[i,0] := 1;
^~~
prog.cpp:59:3: error: expected unqualified-id before ‘for’
for i:=1 to m do
^~~
prog.cpp:62:7: error: expected constructor, destructor, or type conversion before ‘(’ token
exit(f[m,k]);
^
prog.cpp:63:1: error: ‘end’ does not name a type
end;
^~~
prog.cpp:64:1: error: ‘procedure’ does not name a type
procedure process;
^~~~~~~~~
prog.cpp:65:1: error: ‘var’ does not name a type
var i,j,dem : longint;
^~~
prog.cpp:66:5: error: ‘dau’ does not name a type
dau,cuoi : longint;
^~~
prog.cpp:67:1: error: ‘begin’ does not name a type
begin
^~~~~
prog.cpp:69:3: error: ‘m’ does not name a type
m := n;
^
prog.cpp:70:3: error: ‘kq’ does not name a type
kq := tinh;
^~
prog.cpp:71:3: error: ‘dau’ does not name a type
dau := 1;
^~~
prog.cpp:72:3: error: expected unqualified-id before ‘while’
while (dau<=n) do
^~~~~
prog.cpp:75:5: error: ‘m’ does not name a type
m := 1; a[1] := a[dau];
^
prog.cpp:75:13: error: ‘a’ does not name a type
m := 1; a[1] := a[dau];
^
prog.cpp:76:5: error: expected unqualified-id before ‘while’
while (cuoi<=n) and (b[cuoi]=b[dau]) do
^~~~~
prog.cpp:79:9: error: ‘a’ does not name a type
a[m] := a[cuoi];
^
prog.cpp:80:12: error: expected constructor, destructor, or type conversion before ‘(’ token
inc(cuoi);
^
prog.cpp:81:7: error: ‘end’ does not name a type
end;
^~~
prog.cpp:82:5: error: expected unqualified-id before ‘if’
if cuoi-dau>=k then
^~
prog.cpp:84:5: error: ‘dau’ does not name a type
dau := cuoi;
^~~
prog.cpp:85:3: error: ‘end’ does not name a type
end;
^~~
prog.cpp:86:1: error: ‘end’ does not name a type
end;
^~~
prog.cpp:87:1: error: ‘procedure’ does not name a type
procedure print;
^~~~~~~~~
prog.cpp:88:1: error: ‘begin’ does not name a type
begin
^~~~~
prog.cpp:89:28: error: expected constructor, destructor, or type conversion before ‘(’ token
assign(output,fo);rewrite(output);
^
prog.cpp:90:10: error: expected constructor, destructor, or type conversion before ‘(’ token
writeln(kq);
^
prog.cpp:91:8: error: expected constructor, destructor, or type conversion before ‘(’ token
close(output);
^
prog.cpp:92:1: error: ‘end’ does not name a type
end;
^~~
prog.cpp:93:1: error: ‘begin’ does not name a type
begin
^~~~~
prog.cpp:95:3: error: ‘process’ does not name a type
process;
^~~~~~~
prog.cpp:96:3: error: ‘print’ does not name a type
print;
^~~~~
prog.cpp:97:1: error: ‘end’ does not name a type
end.
^~~
stdout
Standard output is empty