├── updater.rb └── README.md /updater.rb: -------------------------------------------------------------------------------- 1 | require 'mechanize' 2 | 3 | README_FILE = './README.md' 4 | NO_TIME = Float::INFINITY 5 | 6 | repos = {} 7 | agent = Mechanize.new 8 | 9 | file_content = File.open(README_FILE).read 10 | file_table_content = file_content.match(/\|.*\|/m)[0] 11 | file_table_lines = file_table_content.split("\n") 12 | file_table_header = file_table_lines[0..1] 13 | file_table_lines[2..-1].each do |line| 14 | _, positions, url, lang, time, name, _ = line.split('|').map(&:strip) 15 | positions = positions.split(',').map(&:to_i) 16 | name = url if name.empty? 17 | time = time.to_f 18 | time = Float::INFINITY if time.zero? 19 | repos[name] = { positions: positions, url: url, lang: lang, time: time.to_f, name: name } 20 | end 21 | 22 | urls = %w(https://highloadcup.ru/rating/round/1/ https://highloadcup.ru/rating/round/2/) 23 | urls.each_with_index do |url, i| 24 | page = agent.get(url) 25 | tr_tags = page.search('.rating.table-responsive.bg-blue-light2 > table > tbody > tr, .rating > table.bg-blue-light2 > tbody > tr') 26 | tr_tags.each do |tr| 27 | cells = tr.search('td').map(&:inner_text) 28 | name = cells[3].split("\n").first 29 | repo = repos[name] 30 | next unless repo 31 | repo[:positions][i] = cells[0].to_i 32 | time = cells.last.to_f 33 | repo[:time] = [time, repo[:time]].reject(&:zero?).min 34 | end 35 | end 36 | 37 | fields = %i(position url lang time name) 38 | new_table_rating = repos.values.sort_by { |repo| repo[:time] }.map do |repo| 39 | repo[:name] = nil if repo[:name].start_with? 'http' 40 | repo[:time] = nil if repo[:time].infinite? 41 | time = repo[:time].to_f 42 | repo[:time] = time.round(2) if time.to_i.to_s.size > 4 43 | repo[:position] = repo[:positions].join(', ') 44 | ([nil] + fields.map { |f| repo[f] } + [nil]).join(' | ').strip 45 | end 46 | new_file_table_content = (file_table_header+new_table_rating).join("\n") 47 | 48 | file_content.gsub!(file_table_content, new_file_table_content) 49 | File.open(README_FILE, 'w') { |f| f.write file_content } 50 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Highloadcup 2017 solutions 2 | 3 | [Task](https://github.com/sat2707/hlcupdocs), [Performance/validity checker](https://github.com/AterCattus/highloadcup_tester), 2017, [2018](https://github.com/proton/highloadcup18_solutions), [2021](https://github.com/proton/highloadcup21_solutions) 4 | 5 | | Место | Ссылка | Язык | Штраф | Имя | 6 | | ------------- | ------------- | ------------- | ------------- | ------------- | 7 | | 1, 3 | https://github.com/cdump/highloadcup | С | 121.81437 | Максим Андреев | 8 | | 7, 1 | https://github.com/nikita-uvarov/highloadcup-travels-solution | C++ | 127.10408 | Никита Уваров | 9 | | 6 | https://github.com/alex-shch/hlc-2017 | Go | 134.54521 | Александр Щукин | 10 | | 9, 5 | https://github.com/DragoonXen/HL-cup_2017 | C++ | 136.28793 | Алексей Дичковский | 11 | | 10, 13 | https://github.com/evgsid/highload_solution | C++ | 136.47385 | Евгений Сидоренко | 12 | | 13, 4 | https://github.com/tyamgin/highloadcup | C++ | 137.02302 | Иван Тямгин | 13 | | 12, 17 | https://github.com/wizzardo/highloadcup | Java | 140.54994 | Mikhail Bobrutskov | 14 | | 15, 11 | https://github.com/AterCattus/bicycle-mrhlc | Go | 145.24654 | Алексей Акулович | 15 | | 16, 22 | https://github.com/mtrempoltsev/hlcup2017 | С++ | 145.83196 | Максим Тремпольцев | 16 | | 17, 21 | https://github.com/irqlevel/http_server_hlcup2017 | C | 146.49961 | Andrey Smetanin | 17 | | 20, 18 | https://github.com/kromberg/highload | С++ | 156.0643 | Егор Кромберг | 18 | | 21, 49 | https://github.com/olegator77/hlcup_reindex | C++ | 157.77575 | Oleg Gerasimov | 19 | | 30 | https://github.com/dbf256/highloadcup-travel | Java | 185.75597 | Алексей Москвин | 20 | | 31, 32 | https://github.com/chemist777/highloadcup2017 | Java+C | 189.76677 | Александр Харитонов | 21 | | 42, 14 | https://github.com/xzfc/highloadcup | C++ | 190.32211 | Jerky McJerkface | 22 | | 32 | https://github.com/0xd34d10cc/highloadcup | Rust | 191.02502 | Jon Snow | 23 | | 47, 25 | https://github.com/vertohod/HighloadCup | С++, rapidjson | 202.42794 | Sergey Potapov | 24 | | 52, 28 | https://github.com/WebProdPP/highloadcup | Go | 207.89232 | Александр Майорский | 25 | | 43, 37 | https://github.com/Mons/hlcup | Perl | 212.34872 | Mons Anderson | 26 | | 50, 39 | https://github.com/oioki/highloadcup2017 | Go | 223.65799 | Alexander Oioki | 27 | | 54, 44 | https://github.com/proton/highloadcup17_go | Go | 234.53744 | Peter Savichev | 28 | | 57, 46 | https://github.com/ei-grad/hlcup | Go | 241.77205 | Андрей Григорьев | 29 | | 59, 47 | https://github.com/evis/highloadcup-2017-08 | Scala | 246.35233 | Evgeny Veretennikov | 30 | | 63 | https://github.com/FedorZaytsev/highloadcup2017 | Go | 249.87749 | Fedor Zaytsev | 31 | | 82 | https://github.com/c0va23/highloadcup_round_1 | Rust | 272.86656 | Дмитрий Федоренко | 32 | | 83 | https://github.com/ruslanys/highloadcup | Java | 274.20083 | Руслан Молчанов | 33 | | 85 | https://github.com/kswaldemar/highloadcup2017 | C++ | 279.64737 | Киселев Владимир | 34 | | 92 | https://github.com/cdfeasy/highloadcup | Java | 303.86881 | Дмитрий Асадуллин | 35 | | 97 | https://github.com/urakozz/go-hlcup2017 | Go | 317.80908 | Юра Козырев | 36 | | 99 | https://github.com/lockie/highload-cup | C, Python | 325.2246 | Андрей Кравчукъ | 37 | | 123 | https://github.com/vania5595/highloadcup2017 | Go | 468.68194 | Ваня Широкопояс | 38 | | 124 | https://github.com/lattenwald/highloadcup.ru | Elixir | 506.82566 | Александр Кюсев | 39 | | 131 | https://github.com/estin/travels-task | Rust | 791.69732 | Евгений Татаркин | 40 | | 136 | https://github.com/server-may-cry/highloadcup_17 | Go | 1028.86225 | Сергей Оплетаев | 41 | | 139 | https://github.com/alexk8/mrghighloadcup17 | C# | 1296.42748 | Alex K | 42 | | 142 | https://github.com/undying/highloadcup-2017 | Nginx+Lua+Redis | 2126.16902 | Денис Божок | 43 | | 149 | https://github.com/SHaaD94/highload2017 | Lua+Tarantool | 3565.56944 | Евгений Зуйкин | 44 | | 153 | https://github.com/volyx/ratpack | Java | 4431.67258 | Дмитрий Волыхин | 45 | | 167 | https://github.com/kak-tus/avery | Perl | 18866.41 | Андрей Кузьмин | 46 | | 169 | https://github.com/Alexander8/highload_cup | C# | 19899.27 | Александр Лифшиц | 47 | | 171 | https://github.com/maierru/hlcup_elixir | Elixir | 37226.29 | Юрий Кудряшов | 48 | | 173 | https://github.com/masterdidoo/hiload | ASP.NET Core | 48041.27 | Александр Семенов | 49 | | 182 | https://github.com/akzhan/highload-cup-1 | Crystal | 249142.25 | Akzhan Abdulin | 50 | | 214 | https://github.com/maximzasorin/highloadcup-1 | Javascript | 649548.64 | Maxim Zasorin | 51 | | 246 | https://github.com/ilvar/hlcup2017 | Go | 1284090.51 | Arcady Chumachenko | 52 | | 247 | https://github.com/oleggromov/hlc2017 | Javascript | 1295339.52 | Oleg G | 53 | | 251 | https://github.com/mkpankov/rustler | Rust | 1413777.27 | Михаил Панков | 54 | | 252 | https://github.com/ebogdanov/highloadcup-solution | PHP | 1436469.91 | Евгений Богданов | 55 | | 256 | https://github.com/SuperVasya/highloadcup | Python | 1514831.39 | Eugene Karimov | 56 | | | https://github.com/la0rg/highloadcup | Go | | | 57 | | | https://github.com/ilov3/highloadcup | Python | | Bulat Kurbangaliev | 58 | | | https://github.com/damner/highloadcup-php | PHP | | Денис Винокуров | 59 | | | https://github.com/essildoor/tengu-travels | Java | | | 60 | | | https://github.com/bochsdbg/hlcup | C++ | | | 61 | | | https://github.com/essildoor/kona-travels | Java | | | 62 | | | https://github.com/disc/highloadcup | Go | | | 63 | 64 | Or you can search by tag: https://github.com/search?q=topic%3Ahighloadcup&type=Repositories 65 | --------------------------------------------------------------------------------