Problems
Pick a problem and write your solution in the built-in editor. The judge runs it against real test cases while you watch, and the wider archive is open to read whenever you like.
Total results1,012 problems
| Title | Level | Topics | Solved | Time limit | Memory limit | Judge |
|---|---|---|---|---|---|---|
| Faulty RobotGiven a directed graph where at most one designated forced edge leaves each node, count the nodes where the robot can end up stopping if it breaks the forced rule at most once along the way. | Medium6 | GraphDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Loading CargoDecide whether N capsules can be split between two compartments of capacities L and R so that no conflicting pair shares a compartment. | Medium6 | GraphDFS+2 | No attempts yet | 3s | 512 MB | Judgeable |
| Leveling the TilesGiven a grid of heights, each impact lowers one tile and all tiles connected to it at the same height; find the minimum impacts to make every tile equal. | Medium6 | GraphBFS+2 | No attempts yet | 5s | 512 MB | Judgeable |
| Balanced TreeGiven a tree whose vertices each hold A or B, swap characters along edges so no edge joins equal letters, using the fewest swaps, or report -1. | Medium6 | TreeDFS+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Hidden HierarchyBuild a directory tree from file paths, and print the smallest set of directories (expanding or collapsing as needed) that covers every directory whose total size is at least t. | Medium6 | TreeHash map+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Flow FreeGiven a 4x4 Flow Free board with 3 or 4 color pairs, decide whether all cells can be covered by non-crossing paths joining matching endpoints. | Medium6 | BacktrackingDFS+1 | No attempts yet | 2s | 512 MB | Judgeable |
| The Components GameFor each board, pick the single column to turn entirely black that maximizes the total number of same-color connected regions, breaking ties by more white regions. | Medium6 | GraphDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Barn PaintingCount the proper 3-colorings of a tree consistent with some pre-colored nodes, modulo 1e9+7. | Medium6 | TreeDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| The Bovine ShuffleGiven a functional graph where each position i sends its cow to a_i, count the positions that hold at least one cow no matter how many shuffles are applied. | Medium6 | GraphDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Tournament ChartParse a knockout bracket given as a string and decide whether the reported win counts for all players can be consistent with some assignment of match winners. | Medium6 | TreeDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Anagram Pyramids (Hard)Given a dictionary and query word pairs, decide whether an anagram pyramid can be built from the top word down to the bottom word. | Medium6 | GraphDFS+1 | No attempts yet | 10s | 512 MB | Judgeable |
| MooTube (Silver)Given a weighted tree, for each query (k, v) count the vertices whose bottleneck distance (minimum edge on the path) from v is at least k. | Medium6 | GraphDFS+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Pepper WreathGiven a tree whose vertices carry non-negative weights and a cap k, find the minimum number of edges to cut so every resulting component has total weight at most k. | Medium6 | TreeDFS+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Directory TraversalGiven a directory tree, choose a directory that minimizes the total length of all relative paths from it to every file. | Medium6 | TreeDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Sejin VirusGiven a directed graph of facilities and pipes, find the minimum number of starting nodes from which all nodes are reachable. | Medium6 | GraphDFS+1 | No attempts yet | 1s | 512 MB | Judgeable |
| Tree Country Tour GuideGiven the move sequence of a shortest round trip that visits every node of an unknown rooted tree, reconstruct each city's parent. | Medium6 | StackTree+1 | No attempts yet | 1s | 512 MB | Judgeable |
| You on That DayGiven measured environmental factors and one-operation definitions, compute each factor's partial derivative of HAPPY and print it as a reduced fraction. | Medium6 | Dynamic programmingDFS+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Tree and ColorsGiven a rooted tree with colored vertices and queries f(v,c) counting subtree vertices of color at most c, print the sum of all answers modulo 1e9+7. | Medium6 | TreeDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Two RobotsOn a weighted tree, two robots at given nodes must meet on some edge or its endpoints; find the minimum combined distance traveled. | Medium6 | TreeDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Mosaic Logic PuzzleGiven clue numbers on a border-extended grid saying how many of the 3x3 neighbors are black, color cells black or report impossibility. | Medium6 | BacktrackingDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| ParadeGiven an undirected graph with V vertices and E edges, decide whether it has an Eulerian circuit that traverses every edge exactly once. | Medium6 | GraphUnion-find+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Is-A? Has-A? Who Knowz-A?Given is-a and has-a edges between classes, answer queries whether one class is-a or has-a another using inheritance and field transitivity. | Medium6 | GraphBFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| DebloGiven a tree with numbers on its nodes, add up the XOR of every node-value along every path between two nodes, counting single-node paths too. | Medium6 | TreeBit manipulation+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Hotel ManagementEach room belongs to exactly two switches; find whether pressing some subset of switches turns every room's lock state to open. | Medium6 | GraphDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Making a ShapeIn a grid of 0s and 1s, find the largest connected group of 1s obtainable by flipping exactly one 0 cell to 1. | Medium6 | GraphDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Ball on a ChessboardEach cell of an R by C board holds a distinct number; every ball rolls to the smallest neighbor until it reaches a local minimum, and we must count how many balls stop on each cell. | Medium6 | GraphDynamic programming+2 | No attempts yet | 2s | 512 MB | Judgeable |
| DFS Special JudgeGiven a tree and a permutation of its vertices, decide whether that permutation can be the DFS visit order starting from vertex 1. | Medium6 | DFSTree+2 | No attempts yet | 2s | 512 MB | Judgeable |
| The Great Revegetation (Silver)Count the binary assignments of grass types to N pastures that satisfy M same-or-different constraints on pairs, and print the count in binary. | Medium6 | Union-findGraph+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Exits in ExcessGiven a directed graph, choose at most half of its edges to delete so that the remaining graph has no directed cycle. | Medium6 | GraphDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Finding the RankGiven a set of pairwise comparisons among N students, find the best and worst possible rank of student X over all total orders consistent with the comparisons. | Medium6 | GraphDFS+2 | No attempts yet | 1s | 512 MB | Judgeable |
| StrapsChoose a set of straps forming a rooted tree: each strap occupies one port of its parent, one strap hangs from the phone, and total happiness is maximized. | Medium6 | Dynamic programmingTree+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Improve SPAMGiven nested mailing lists, count how many messages reach client emails before deduplication and how many distinct emails are reached, both modulo 1e9+7. | Medium6 | GraphDFS+2 | No attempts yet | 0.3s | 512 MB | Judgeable |
| A Water Slide at Catholic University??Given a directed graph, find the minimum number of starting vertices whose reachable sets cover every vertex. | Medium6 | GraphBFS+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| Bob in WonderlandGiven a tree of N connected links, find the minimum number of link reconnections needed to turn it into a path (each vertex has degree at most two). | Medium6 | TreeGreedy+1 | No attempts yet | 2s | 512 MB | Judgeable |
| Railway TourGiven an undirected graph, find the minimum number of edge-disjoint trails needed to cover every edge exactly once. | Medium6 | GraphDFS+2 | No attempts yet | 1s | 512 MB | Judgeable |
| Milk VisitsGiven a tree with each node labeled G or H, answer queries asking whether the path between two nodes contains at least one node of a given label. | Medium6 | TreeDFS+2 | No attempts yet | 1s | 512 MB | Judgeable |
| PasswordCount the Android-style 3x3 patterns whose segment directions match a given string, allowing any segment lengths, with no self-intersection allowed. | Medium6 | DFSBacktracking+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Nested Set ModelRoot an undirected tree at S, traverse children in ascending order, and label each node with nested left/right interval numbers. | Medium6 | DFSTree+2 | No attempts yet | 1s | 1024 MB | Judgeable |
| MafiaGiven guilt scores and a reaction matrix, the mafia Eunjin picks one night victim at a time and must survive as long as possible, returning the maximum number of nights. | Medium7 | Bit manipulationDFS+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Coin Board GameA coin on a grid jumps exactly the digit on its cell in one of four directions; find the maximum number of moves before it leaves the board or hits a hole, or -1 if it can move forever. | Medium7 | Dynamic programmingDFS+2 | No attempts yet | 2s | 512 MB | Judgeable |
| Number of Vertex Cactus ComponentsGiven a graph, count connected components that are vertex cacti, meaning every vertex lies in at most one simple cycle. | Medium7 | GraphDFS+1 | No attempts yet | 2s | 128 MB | Judgeable |
| MafiaGiven a graph of tollgates and highways, choose a minimum-cost set of intermediate tollgates whose removal disconnects the start from the destination, solved via vertex-split min-cut/max-flow. | Medium7 | GraphBFS+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Oh Min-sik's WorryFind the maximum money achievable traveling from city A to city B using weighted directed edges and city rewards, detecting infinite gain via positive cycles. | Medium7 | GraphShortest path+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Special NodesIn a rooted tree where child weights exceed parent weights, mark vertices special or ordinary to minimize the total of each ordinary vertex's weight minus its nearest special ancestor's weight. | Medium7 | Dynamic programmingTree+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Group Word ReconstructionReconstruct the unique group word, where every letter forms one contiguous block, by arranging all given unordered pieces, or report impossibility or multiple solutions. | Medium7 | GraphString+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Finding Domino TilingsCount the ways to tile a fixed 8x7 numeric grid with all 28 distinct dominoes so that each domino's pair matches the covered cell values. | Medium7 | BacktrackingBit manipulation+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Rook AttackGiven an R by C board with N unusable squares, find the maximum number of non-attacking rooks that can be placed on the remaining squares. | Medium7 | GraphBFS+2 | No attempts yet | 2s | 128 MB | Judgeable |
| GraduationMatch already-taken and newly taken courses to graduation requirements via bipartite matching, minimizing extra courses and finding the lexicographically smallest such set. | Medium7 | GraphGreedy+2 | No attempts yet | 2s | 128 MB | Judgeable |
| PasturesGroup adjacent rectangular pastures into connected clusters, find the cluster with the largest bounding-box gap, then pick the smallest pasture whose removal keeps that cluster connected. | Medium7 | DFSGraph+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Drum MessageGiven K and M, construct a de Bruijn sequence of length K^M on a drum so every length-M string over digits 0..K-1 appears exactly once, or print -1 if impossible. | Medium7 | GraphDFS+2 | No attempts yet | 5s | 512 MB | Judgeable |
| BishopsGiven an N by N board with some cells forbidden, find the maximum number of bishops that can be placed so no two attack each other along diagonals. | Medium7 | GraphDFS+2 | No attempts yet | 10s | 128 MB | Judgeable |
| Removing StonesGiven stones on an n by n grid, find the minimum number of row or column sweeps needed to remove every stone, which reduces to minimum vertex cover in a bipartite graph. | Medium7 | GraphDFS+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Treasure HuntGiven a tree of rooms, compute the minimum worst-case number of queries needed to locate a hidden treasure using an optimal centroid-based questioning strategy. | Medium7 | TreeDivide and conquer+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Winning PracticeGiven a graph, assign each vertex to one of two groups so that every vertex has an even number of same-group neighbors, and output one valid group. | Medium7 | GraphDFS+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Tree Path PartitionGiven a tree and integer K, find the minimum number of vertex-disjoint paths of length at most K that cover all vertices. | Medium7 | TreeGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Car RaceGiven a directed graph with no cycles avoiding vertex 1, find the maximum-score simple route from checkpoint 1 back to checkpoint 1 and print it. | Medium7 | GraphDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| TrampolineGiven building heights, adjacency-based jump rules, and trampolines that allow teleporting anywhere, find the maximum number of distinct buildings reachable starting from building K. | Medium7 | GraphDFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Road RepairGiven a tree with per-edge reducible travel times and a total repair budget, minimize the maximum distance from city 1 to any other city by optimally allocating budget across edges. | Medium7 | Binary searchTree+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Two Snow PlowsGiven a tree rooted at S, find minimum total edge traversal cost for two walks starting at S that together cover every edge, without returning to S. | Medium7 | TreeDynamic programming+1 | No attempts yet | 1s | 128 MB | Judgeable |
| LinkGiven a functional graph where each node has exactly one outgoing edge, find the minimum number of edges to add so every node is reachable from node 1 within K hops. | Medium7 | GraphGreedy+1 | No attempts yet | 2s | 64 MB | Judgeable |
| Alice and BobGiven all polygon sides and non-crossing diagonals as an unordered edge list, reconstruct the convex polygon's cyclic vertex order. | Medium7 | GraphDFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| InspectionGiven a DAG representing ski slopes, find the minimum number of downhill paths needed to cover every edge, which reduces to a minimum path cover via bipartite matching. | Medium7 | GraphDFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Kripke ModelGiven a Kripke model with n up to 10000 states, compute the set of states satisfying the CTL formula E(x U (AG y)) using fixed-point graph algorithms. | Medium7 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Lucky CitiesGiven an undirected graph, count vertices that lie on at least one simple cycle of odd length. | Medium7 | GraphDFS+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Locks and KeysDetermine reachability on a tree with colored locks and single-use keys held one at a time, requiring a search over reachable key/room states. | Medium7 | DFSGraph+1 | No attempts yet | 2s | 128 MB | Judgeable |
| Last Minute ConstructionsGiven a forest of undirected roads plus a set of directed tunnels that must all be used, decide whether a simple path exists from a start to an end village that uses exactly those tunnels. | Medium7 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Worm TurnsFind a start cell and first direction that maximize how many food pieces a self-avoiding worm eats, turning only when blocked. | Medium7 | DFSBrute force+2 | No attempts yet | 3s | 128 MB | Judgeable |
| Family FortuneChoose K nodes in a rooted tree, no one an ancestor of another, maximizing the sum of weights; print 0 if impossible. | Medium7 | Dynamic programmingTree+1 | No attempts yet | 10s | 128 MB | Judgeable |
| Prime-Free SequenceFind the lexicographically smallest permutation of n..m where sums of any 2 to d consecutive numbers are all non-prime, or report none. | Medium7 | BacktrackingDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| XYZZYGiven rooms with energy values and one-way doors, decide if the player can reach room n from room 1 while energy stays above zero, where rooms may repeat. | Medium7 | GraphShortest path+1 | No attempts yet | 1s | 128 MB | Judgeable |
| PegsGiven a 5x5 peg solitaire board with empty, peg, and blocked cells, find the minimum number of pegs reachable by any sequence of horizontal or vertical jumps. | Medium7 | DFSBacktracking+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Hex Tile EquationsFind the unique Hamiltonian path through a small hex grid of digit and operator tiles that spells a valid left-to-right equation with both sides equal. | Medium7 | BacktrackingDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Trie, Again TrieGiven trees encoded in preorder, find the repeated subtree whose replacement by one shared copy saves the most nodes, breaking ties by size then preorder. | Medium7 | TreeDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| MobilesGiven a mobile tree with one unknown object weight, find the weight that balances every bar and check that no two bars collide when they rotate. | Medium7 | TreeDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Wealthy FamilyGiven a rooted tree with a weight on each node, pick exactly k nodes with no ancestor relation between any two, maximizing the total weight, over multiple test cases. | Medium7 | TreeDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Jonny Hates MathSplit a digit string into positive addends of at most 5 digits with no leading zeros that sum to a given total, minimizing the number of plus signs and breaking ties lexicographically. | Medium7 | DFSBacktracking+2 | No attempts yet | 5s | 128 MB | Judgeable |
| Identically Colored Panels ConnectionOn a grid of up to 8 by 8 panels in six colors, the upper-left connected region changes color five times, absorbing same-colored neighbors; maximize the final region of the target color. | Medium7 | DFSBFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Discrete SpeedFind the fastest route from a start to a goal city where a car enters each road at an integer speed, changes speed by at most 1 per city, starts and ends at speed 1, and cannot U-turn. | Medium7 | GraphShortest path+2 | No attempts yet | 8s | 128 MB | Judgeable |
| Gokigen NanameFill an n by n grid with one diagonal per cell so each numbered lattice point has exactly that many diagonal endpoints and no diagonal cycle forms. | Medium7 | BacktrackingDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Social Network VaccinationsGiven a graph with n at most 30 and D at most 6, choose D vertices to vaccinate so that the largest connected component remaining is as small as possible. | Medium7 | GraphBrute force+2 | No attempts yet | 2s | 128 MB | Judgeable |
| GearboxGiven gears of unknown teeth counts grouped on rods and pairs of interlocked gears, decide whether every rod can turn for any assignment of teeth counts to gear types. | Medium7 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| MondriaanGiven non-overlapping rectangles that tile a big rectangle, count the 3-colorings of the adjacency graph where orthogonally touching regions differ and white is a fourth free option. | Medium7 | GeometryGraph+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Type PrinterFind the minimum number of add, remove, and print operations to type N distinct words on a printer that keeps a single editable string, with any print order allowed. | Medium7 | TrieDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Santa Claus and RudolphCount the closed tours that start and end at the single church, visiting every house once, where each move is a straight horizontal or vertical glide that may not pass over an already visited house. | Medium7 | BacktrackingDFS+2 | No attempts yet | 12s | 128 MB | Judgeable |
| The Lightest MobileGiven a tree of balanced rods with integer lever ratios, assign positive integer masses to all weights so every rod balances and the total mass is minimized. | Medium7 | TreeDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| The Longest ChainGiven n strings, each with labeled rings a and b at its ends, find the number of vertices in the longest trail in the resulting multigraph. | Medium7 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Traveling ShoemakerCities each belong to one or two color confederations; moving between cities consumes and produces tickets. Decide if a start city exists to visit every city exactly once. | Medium7 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| AcquapiaMultiple test cases give several river trees; for each city pair, report whether a route exists and, if so, the unique city where the ship must switch from upstream to downstream. | Medium7 | TreeDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| X-MartGiven customers who each vote for up to two products to keep and against up to two to drop, decide whether some keep/drop assignment pleases all of them. | Medium7 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Telecommunication PartnersGiven an undirected graph and K, find the largest connected vertex set where each vertex has degree at least K inside the set. | Medium7 | GraphGreedy+1 | No attempts yet | 1s | 128 MB | Judgeable |
| Running Away From the BarnFor every node in a weighted tree rooted at node 1, count the descendants within total distance L along the downward path, including the node itself. | Medium7 | TreeDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Bovine AllianceCount assignments of each of M trails to one of its two endpoint farms so that no farm builds more than one trail, modulo 1e9+7. | Medium7 | GraphCombinatorics+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cow CalisthenicsRemove exactly S edges from a tree so that the largest diameter among the resulting components is as small as possible, and output that minimum diameter. | Medium7 | TreeBinary search+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Tree DecorationPlace a minimum-cost number of ornaments on each node of a rooted tree so every subtree holds at least its required count, given per-node unit costs. | Medium7 | TreeGreedy+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Slowing downFor each cow in order, count how many pastures already occupied by earlier cows lie on the tree path from node 1 to that cow's pasture. | Medium7 | TreeDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Cow PoliticsGiven a tree with each node belonging to one of K parties, find the diameter (greatest distance between any two nodes) of the nodes in each party. | Medium7 | TreeDFS+2 | No attempts yet | 2s | 128 MB | Judgeable |
| Maximum FlowCompute the maximum flow from node A to node Z through a network of pipes with given capacities, using series and parallel reductions. | Medium7 | GraphImplementation+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Corrupted BSTGiven a binary tree with distinct integer keys, find the minimum number of node keys to change so the tree satisfies the BST ordering, keeping its shape fixed. | Medium7 | TreeDynamic programming+2 | No attempts yet | 1s | 128 MB | Judgeable |
| PipesGiven net volume changes at each vertex of a connected graph, decide whether the flow on every edge is uniquely determined and print those flows if so. | Medium7 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |
| Slash MazeCount the closed loops in a grid of slash and backslash walls and report the longest loop's length, where each cell splits into two triangles. | Medium7 | GraphDFS+2 | No attempts yet | 1s | 128 MB | Judgeable |