Skip to content

Add (opinionated) warnings for keywords #396

Open

Description

@gkreitz

Keywords are currently very underspecified in the problem standard. To help problem setters, and the community, it would make sense to me if problemtools was a bit opinionated in keyword usage (obviously, never giving an error, but nudging via warnings).

Firstly, we should probably add the same rule we're moving to in Kattis: keywords should only consist of lowercase letters, numbers, and hyphens. This will catch a number of errors and inconsistencies that we've seen in problem packages, with keywords such as "ad", "hoc", or "combinatorics," (with a trailing comma in the keyword).

Secondly, I'm toying with the idea of creating a list of "recommended" keywords, and nudging toward their usage. There are concepts that can be written in multiple ways ("bfs" vs "breadth-first-search", "maths" vs. "math"), and I think it would be useful to nudge all problems in one direction. One potential implementation would be to attempt to maintain a list of "well-known" keywords, and nudge towards those. Obviously, that list will never be complete - my hope would be that people would contribute things they feel are missing.

Activity

  1. Matistjati commented on Mar 13, 2026

    @Matistjati
    Contributor

    This is a good direction. IMHO, the biggest problem with keywords right now is that we aren't opinionated enough.
    I like the idea of a set of well-known keywords. It might also be a good idea to impose some sort of tree structure. Example:

    graph
      2-sat
      flow
        matching
      dfs
      shortest path
      dsu
      trees
    
    queries
      range queries
    
    math
      combinatorics
      number theory
        
    

    We will probably have to take a decision on what a tog should even be. For an interesting example, I think that Ford-Fulkersson, Edmonds-Karp and Push-relabel don't deserve a tag- in 98% of problems, they are interchangable- thus these tags should instead just be "flow". On the other hand, I would argue that berlekamp-massey deserves its own tag- even if you can recover linear recurrences via matrix math or half-gcd, this is what the community knows it by.

    Potential sources of inspiration

    KACTL's could probably serve as a good source of inspiration: https://github.com/kth-competitive-programming/kactl/tree/main/content

    Codeforces' also has their own set of pretty arbitrary tags:

    Details
    2-sat
    binary search
    bitmasks
    brute force
    chinese remainder theorem
    combinatorics
    communication
    constructive algorithms
    data structures
    dfs and similar
    divide and conquer
    dp
    dsu
    expression parsing
    fft
    flows
    games
    geometry
    graph matchings
    graphs
    greedy
    hashing
    implementation
    interactive
    math
    matrices
    meet-in-the-middle
    number theory
    probabilities
    schedules
    shortest paths
    sortings
    string suffix structures
    strings
    ternary search
    trees
    two pointers
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions