Tap here to switch tabs
Problem
Submissions

Problem: Maximum Elegance of a K-Length Subsequence

Maximum Elegance of a K-Length Subsequence asks you to choose exactly k items from a profit-and-category array and maximize total profit plus the square of its distinct category count.

Statement

You are given a two-dimensional integer array items of length nn and an integer k.

Each item items[i] = [profit_i, category_i] indicates that the item at index i has a profit of profit_i and belongs to category category_i.

Define the elegance of a chosen subsequence of items as:

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Elegance of a K-Length Subsequence

Maximum Elegance of a K-Length Subsequence asks you to choose exactly k items from a profit-and-category array and maximize total profit plus the square of its distinct category count.

Statement

You are given a two-dimensional integer array items of length nn and an integer k.

Each item items[i] = [profit_i, category_i] indicates that the item at index i has a profit of profit_i and belongs to category category_i.

Define the elegance of a chosen subsequence of items as: