Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var n,m,k
- function readTeam(s)
- {
- team = new Object()
- team.name = s[0]
- team.solved = 0
- team.time = 0
- team.last = 0
- team.inLeak = false
- team.upgrade = upgrade
- team.problems = s
- team.problems.shift()
- for (var j=0;j<n;j++)
- {
- team.problems[j*3+1] = +team.problems[j*3+1]
- team.problems[j*3+2] = +team.problems[j*3+2]
- verdict = team.problems[j*3+0]
- submit = team.problems[j*3+1]
- time = team.problems[j*3+2]
- if (verdict==='+')
- {
- team.time+=time+(submit-1)*20;
- ++team.solved
- team.last=Math.max(team.last,time)
- }
- }
- return team
- }
- function cmp2(a,b)
- {
- if (a>b)
- return 1
- if (a==b)
- return 0
- if (a<b)
- return -1
- }
- function cmp(b,a)//returns 1 if a is better b
- {
- if (a.solved!=b.solved)
- return cmp2(a.solved,b.solved)
- if (a.time!=b.time)
- return cmp2(b.time,a.time)
- if (a.last!=b.last)
- return cmp2(b.last,a.last)
- return cmp2(b.name,a.name)
- }
- function upgrade()
- {
- for (var i=0;i<n;i++)
- {
- if (this.problems[3*i]==='.'||this.problems[3*i]==='-')
- {
- this.problems[3*i+2]=240
- this.problems[3*i+1]+=1
- this.problems[3*i]='+'
- this.time+=240+20*(this.problems[3*i+1]-1)
- this.solved+=1
- this.last=240
- }
- }
- }
- function main() {
- s = stdin[0].split(' ')
- n = +s[0]
- m = +s[1]
- k = +s[2]
- teams = new Object()
- for (var i=1;i<=m;i++)
- {
- s = stdin[i].split(' ')
- team = readTeam(s)
- teams[team.name] = team
- }
- for (var i=m+1;i<=m+k;i++)
- {
- s = stdin[i].split(' ')
- team = readTeam(s)
- team.inLeak = true
- teams[team.name] = team
- }
- teamsArr=[]
- for (team in teams)
- {
- teamsArr.push(teams[team])
- }
- teamsArr.sort(cmp)
- var l=-1,r=-1
- for (var i=0;i<m;i++)
- {
- if (teamsArr[i].inLeak)
- {
- r=i
- if (l==-1)
- l=i
- }
- }
- ans="Leaked"
- for (var i=l;i<r;i++)
- {
- if (!teamsArr[i].inLeak)
- {
- teamsArr[i].upgrade()
- if (cmp(teamsArr[i],teamsArr[l])>0)
- {
- ans="Fake"
- break
- }
- }
- }
- console.log(ans)
- }
- const readline = require('readline');
- const rl = readline.createInterface({input: process.stdin});
- var stdin = [];
- rl.on('line', function (line) {stdin.push(line);});
- rl.on('close', main);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement