solving-problems

Implements C++ model solutions, brute-force oracles, and subtask solutions for competitive programming problems.

1|Updated Sep 3, 2026
One-click install
npx skills add https://github.com/nudetiger/competitive-programming-problem-preparer --skill solving-problems-nudetiger
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: solving-problems
Source: https://github.com/nudetiger/competitive-programming-problem-preparer/tree/main/skills/solving-problems
Command: npx skills add https://github.com/nudetiger/competitive-programming-problem-preparer --skill solving-problems-nudetiger

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing correct, limit-fitting C++ for a competitive programming problem is error-prone: choosing the wrong complexity class, missing edge cases, or shipping an unverified greedy can sink an entire problem package. This Skill turns an intended algorithm (or a pasted statement) into a working model solution, a brute-force oracle, and per-subtask solutions with stress testing. ## Core Features & Use Cases - Model and brute-force implementation: Produces sol-main.cpp for the intended algorithm and sol-brute.cpp matching the statement, plus one real solution per OI subtask rung. - Complexity budgeting: Maps maximum N to feasible complexity classes (from O(N!) to O(log N)) so the chosen algorithm fits a 1–2 second limit before any code is written. - Stress testing guidance: Runs the model against the brute oracle on random tests mixing tiny N and the largest N the oracle can finish, catching wrong greedy or unproved invariants. - Constant-factor optimization reference: Ships a black-magic toolbox (pragmas, fast I/O, cache layout, SIMD intrinsics) for solutions that are asymptotically optimal but still TLE. - Use Case: While preparing a Polygon package, you have an intended O(N log N) solution and need the model, an O(N²) brute oracle, and subtask ladders coded and stress-tested before test generation begins. ## Quick Start Ask the assistant to implement the intended solution and a brute-force oracle in C++ for your problem, then stress test them against each other.

Frequently Asked Questions about solving-problems

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a model solution and brute force for a competitive programming problem?

Implement the intended algorithm as sol-main.cpp and a trivial statement-matching brute as sol-brute.cpp, then stress them against each other on random tests. Mix tiny N with the largest N the brute can still finish, typically around 80 rounds.

How do I choose the right time complexity for given constraints?

Budget roughly 10^8–10^9 operations per second: N up to 20–25 allows O(2^N·N), N around 2000–5000 allows O(N²), and N up to 10^5 needs O(N log N). Only budget against the sum of N when the statement explicitly bounds it.

How do I stress test a greedy algorithm in C++?

Write a brute-force oracle that directly follows the statement, generate random small inputs, and diff the outputs of both programs. Stress is essential when correctness is not obvious, such as unproved greedy invariants.

What can I do when my C++ solution is optimal but still gets TLE?

Apply constant-factor optimizations in escalation order: GCC optimization pragmas and fast custom I/O first, then cache-friendly memory layout, replacing slow STL containers, branchless bit tricks, and finally hand-written AVX2 SIMD intrinsics.

Does this skill submit solutions to an online judge?

No, it is not a contest submitter and includes no judge integration. All compilation and stress runs happen locally with g++, and it focuses on preparing solutions for problem packages rather than live contest submission.