Educational Rounds Wrapper — Python Script

Revision en1, by 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.net/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.net/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.net/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.net/contest/598 : AB DE #2 https://codeforces.net/contest/600 : BC E #3 https://codeforces.net/contest/609 : ABCDE #4 https://codeforces.net/contest/612 : ABCDE #5 https://codeforces.net/contest/616 : ABCDE ... #57 https://codeforces.net/contest/1096 : ABC #58 https://codeforces.net/contest/1101 : ABCDE #59 https://codeforces.net/contest/1107 : ABCD #60 https://codeforces.net/contest/1117 : ABCDE #61 https://codeforces.net/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!

Tags python, educational, wrapper

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Adhami 2019-03-14 15:22:51 2242 Initial revision (published)