Untitled

a guest
Feb 5th, 2019
562
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. var n,m,k
2.
4. {
5.     team = new Object()
6.     team.name = s[0]
7.     team.solved = 0
8.     team.time = 0
9.     team.last = 0
10.     team.inLeak = false
12.     team.problems = s
13.     team.problems.shift()
14.     for (var j=0;j<n;j++)
15.     {
16.         team.problems[j*3+1] = +team.problems[j*3+1]
17.         team.problems[j*3+2] = +team.problems[j*3+2]
18.         verdict = team.problems[j*3+0]
19.         submit = team.problems[j*3+1]
20.         time = team.problems[j*3+2]
21.         if (verdict==='+')
22.         {
23.             team.time+=time+(submit-1)*20;
24.             ++team.solved
25.             team.last=Math.max(team.last,time)
26.         }
27.     }
28.     return team
29. }
30.
31. function cmp2(a,b)
32. {
33.     if (a>b)
34.         return 1
35.
36.     if (a==b)
37.         return 0
38.
39.     if (a<b)
40.         return -1
41. }
42.
43. function cmp(b,a)//returns 1 if a is better b
44. {
45.     if (a.solved!=b.solved)
46.         return cmp2(a.solved,b.solved)
47.     if (a.time!=b.time)
48.         return cmp2(b.time,a.time)
49.     if (a.last!=b.last)
50.         return cmp2(b.last,a.last)
51.     return cmp2(b.name,a.name)
52. }
53.
55. {
56.     for (var i=0;i<n;i++)
57.     {
58.         if (this.problems[3*i]==='.'||this.problems[3*i]==='-')
59.         {
60.             this.problems[3*i+2]=240
61.             this.problems[3*i+1]+=1
62.             this.problems[3*i]='+'
63.             this.time+=240+20*(this.problems[3*i+1]-1)
64.             this.solved+=1
65.             this.last=240
66.         }
67.     }
68. }
69.
70. function main() {
71.     s = stdin[0].split(' ')
72.     n = +s[0]
73.     m = +s[1]
74.     k = +s[2]
75.     teams = new Object()
76.     for (var i=1;i<=m;i++)
77.     {
78.         s = stdin[i].split(' ')
80.         teams[team.name] = team
81.     }
82.     for (var i=m+1;i<=m+k;i++)
83.     {
84.         s = stdin[i].split(' ')
86.         team.inLeak = true
87.         teams[team.name] = team
88.     }
89.     teamsArr=[]
90.     for (team in teams)
91.     {
92.         teamsArr.push(teams[team])
93.     }
94.     teamsArr.sort(cmp)
95.     var l=-1,r=-1
96.     for (var i=0;i<m;i++)
97.     {
98.         if (teamsArr[i].inLeak)
99.         {
100.             r=i
101.             if (l==-1)
102.                 l=i
103.         }
104.     }
105.     ans="Leaked"
106.     for (var i=l;i<r;i++)
107.     {
108.         if (!teamsArr[i].inLeak)
109.         {
111.             if (cmp(teamsArr[i],teamsArr[l])>0)
112.             {
113.                 ans="Fake"
114.                 break
115.             }
116.         }
117.     }
118.     console.log(ans)
119. }
120.