Educational Rounds Wrapper — Python Script

Правка en1, от Adhami, 2019-03-14 15:22:51

If you ask a Jordanian competitive programmer for a training advice, there is 98% chance that he would recommend you to solve Educational Rounds, ask Hiasat. However, getting your progress in Educational round tracked is hard, so here it comes!

I wrote this script way before, but my friends recently encouraged me to post it. It gets every Educational Round and what you have already solved in it.


import urllib.request, json import datetime s = [] w = [] with urllib.request.urlopen("https://codeforces.me/api/contest.list") as url: data = json.loads(url.read().decode()) for x in data["result"]: if x["name"].startswith("Educational"): w.append(x["name"]) s.append(x["id"]) e = [""]*len(w) #Edit this line to your handle: USER_NAME = "CPX" with urllib.request.urlopen("https://codeforces.me/api/user.status?handle="+USER_NAME) as url: data = json.loads(url.read().decode()) for x in data["result"]: if "verdict" in x and "contestId" in x: if x['verdict'] == 'OK': for i in range(0,len(s)): if x["contestId"] == s[i]: e[i] += x["problem"]["index"] break def contest(solved): if solved == "": return solved ans = [" "]*(ord(solved[-1])-ord("A")+1) for x in solved: ans[ord(x)-ord("A")] = x return "".join(ans) for i in range(0,len(w)): print("#" + str(i+1) + " https://codeforces.me/contest/" + str(s[len(w)-i-1]) + "\t: " + contest("".join(sorted(set(e[len(w)-i-1])))))

Change USER_NAME to match yours, and it will print it in this format:


#1 https://codeforces.me/contest/598 : AB DE #2 https://codeforces.me/contest/600 : BC E #3 https://codeforces.me/contest/609 : ABCDE #4 https://codeforces.me/contest/612 : ABCDE #5 https://codeforces.me/contest/616 : ABCDE ... #57 https://codeforces.me/contest/1096 : ABC #58 https://codeforces.me/contest/1101 : ABCDE #59 https://codeforces.me/contest/1107 : ABCD #60 https://codeforces.me/contest/1117 : ABCDE #61 https://codeforces.me/contest/1132 : ABC

You can copy it or print the output to a file. Check my script for Country-Wise standing.

And as always:

Solve Educational!

Теги python, educational, wrapper

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский Adhami 2019-03-14 15:22:51 2242 Initial revision (published)