Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

グラフの排他制御 #11

Open
4geru opened this issue Jan 1, 2018 · 4 comments
Open

グラフの排他制御 #11

4geru opened this issue Jan 1, 2018 · 4 comments

Comments

@4geru
Copy link
Owner

4geru commented Jan 1, 2018

ACのグラフがうまく表示できていない
solved数が合わない

@4geru
Copy link
Owner Author

4geru commented Jan 2, 2018

排他制御したけど個人ユーザーのAC数と違う...

@4geru
Copy link
Owner Author

4geru commented Jan 2, 2018

  results.uniq! {|result| result.values_at('problem_id', 'user_id', 'contest_id') }

  c = 0
  results.map{|problem|  
    next if problem['point'] == 0
    next if problem['user_id'] != 'ixmel_rd'
    puts problem
    user = problem['user_id']
    time = Time.at(problem['epoch_second'].to_i).to_s[0,10]
    date = Date.parse(time)
    users[user][date] = 0 if users[user][date].nil?
    users[user][date] += 1
    c += 1
  }

c is expect 900 result 903

@4geru
Copy link
Owner Author

4geru commented Jan 2, 2018

  uri = URI.parse(root + users.join(','))
  results = JSON.parse(Net::HTTP.get(uri))

  users = users.map{|user| [user, {} ] }.to_h

  results.uniq! {|result| result.values_at('problem_id', 'user_id', 'contest_id') }

  c = 0
  results.map{|problem|  
   next if problem['result'] != 'AC'
    next if problem['user_id'] != 'ixmel_rd'
    puts problem
    user = problem['user_id']
    time = Time.at(problem['epoch_second'].to_i).to_s[0,10]
    date = Date.parse(time)
    users[user][date] = 0 if users[user][date].nil?
    users[user][date] += 1
    c += 1
  }

c is expect 900 result 888

@4geru
Copy link
Owner Author

4geru commented Jan 2, 2018

  uri = URI.parse(root + users.join(','))
  results = JSON.parse(Net::HTTP.get(uri))

  users = users.map{|user| [user, {} ] }.to_h

  results.uniq! {|result| result.values_at('problem_id', 'user_id') }

  c = 0
  results.map{|problem|  
    next if problem['point'] == 0
    next if problem['user_id'] != 'ixmel_rd'
    puts "#{problem["problem_id"]} #{problem["language"]}"
    user = problem['user_id']
    time = Time.at(problem['epoch_second'].to_i).to_s[0,10]
    date = Date.parse(time)
    users[user][date] = 0 if users[user][date].nil?
    users[user][date] += 1
    c += 1
  }

c is expect 900 result 899

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant