Aaryjoshi's blog

By Aaryjoshi, history, 12 months ago, In English

Suppose you want to practise a specific topic but also dont want some tags like if you want to practise dp problem but dont want it to have a greedy tag. You can also enter a custom rating range. You can run this script locally or on collab.

from ctypes import sizeof
import requests
responce = requests.get("https://mirror.codeforces.com/api/problemset.problems")
data=responce.json()
problems=data['result']['problems']

def customProblems(low,high,ontags,offtags):
  problemInRating=[]
  problemLinks=[]

  for problem in problems:
    if 'rating' in problem:
      if problem['rating']>=low and problem['rating']<=high:
        if all(tag in problem['tags'] for tag in ontags) and all(tag not in problem['tags'] for tag in offtags):
          problemInRating.append(problem)


  for problem in problemInRating:
    link = f"https://mirror.codeforces.com/problemset/problem/{problem['contestId']}/{problem['index']}"
    problemLinks.append(link)
    print(link)

def customisations():
  yestags=['tag1' , 'tag2' , 'tag3']
  notags=['tag1' , 'tag2' , 'tag3']
  low=2000
  high=2000
  customProblems(low,high,yestags,notags)
customisations()

Enter your customisations in the customisation() function. Pls let me know what extra features should I add.

Full text and comments »

  • Vote: I like it
  • +1
  • Vote: I do not like it