AtCoder ABC 004: Grid Rotation, Sequence Swaps, and Ball Distribution

Problem A Given an integer N, output N multiplied by 2. Problem B Statement Given a 4×4 grid, output the grid rotated 180 degrees. Solution This section focuses on permutation operations for square matrices. In the Cartesian coordinate system, three fundamental permutations are commonly used: Permutation f (vertical flip): h[i][j] = g[N + 1 - i ...

Posted on Sat, 07 Nov 2026 16:12:25 +0000 by Isoss

Constructing a Matrix from Row and Column Maximums

Given integers (N, M), a sequence of (N) integers (X = (X_1, X_2, \dots, X_N)), and a sequence of (M) integers (Y = (Y_1, Y_2, \dots, Y_M)). The task is to determine whether there exists an (N \times M) integer matrix (A) with entries between 1 and (N \times M) inclusive such that all entries are distinct, the maximum in row (i) equals (X_i), a ...

Posted on Sun, 01 Nov 2026 16:35:31 +0000 by T_Hayden

AtCoder Beginner Contest 062 Solution

A Problem: Group the numbers 1 to 12 into sets: {1, 3, 5, 7, 8, 10, 12}, {4, 6, 9, 11}, {2}. Given two numbers, determine if they belong to the same group. Solution: This is essentially a connectivity problem, which can be solved using a union-find data structure. const int N = 14; int fa[N]; int find(int x) { return x == fa[x] ? x : fa[x] = fi ...

Posted on Sun, 25 Oct 2026 16:14:45 +0000 by damianraine

Solutions for AtCoder Beginner Contest 369 Problems

The sample cases cover all possible scenarios for this problem. int main() { int x, y; cin >> x >> y; int result = 0; if(x > y) swap(x, y); if(x == y) result = 1; else if((y - x) % 2) result = 2; else result = 3; cout << result << endl; return 0; } </details>### Problem B - Piano Keys Track positions for le ...

Posted on Wed, 21 Oct 2026 16:54:36 +0000 by peyups

AtCoder ABC285 Contest Solutions and Analysis

Problem A: Parent Node Verification Problem Statement: Given a specific tree structure, you need to determine if node a is the parent of node b. Both nodes are numbered between 1 and 15. Solution Approach: The tree follows a simple binary structure where: - The left child of any node n has the value n * 2- The right child of any node n has the ...

Posted on Wed, 21 Oct 2026 16:05:53 +0000 by Goofan

Solving AtCoder Beginner Contest 061: A-D Problem Solutions

Problem A Given three integers A, B, and C, determine whether C falls within the range [A, B], i.e., check if A ≤ C ≤ B. Solution #include <bits/stdc++.h> using namespace std; int main() { int first, last, target; cin >> first >> last >> target; if (first <= target && target <= last) ...

Posted on Mon, 12 Oct 2026 16:53:11 +0000 by jaybones

Solving AtCoder Beginner Contest 010: A Complete Walkthrough

Problem A Given a string (S), produce a new string by appending "pp" to (S). Simply use std::string in C++: std::string s; std::cin >> s; s += "pp"; std::cout << s << "\n"; Problem B There are (n) flowers with petal counts (a_1, a_2, \dots, a_n). Two counting cycles exist: "like, disugsting ...

Posted on Tue, 06 Oct 2026 16:11:29 +0000 by mauri_gato

AtCoder Beginner Contest 059 Problem Solutions

Problem A: Enitial Letter Extraction Given three space-separated lowercase strings, output their initial letters in uppercase. std::string s; std::getline(std::cin, s); for (int i = 0; i < (int)s.size(); i++) { if (i == 0 || s[i - 1] == ' ') std::cout << char(s[i] - 'a' + 'A'); } std::cout << "\n"; Problem B: Large ...

Posted on Fri, 02 Oct 2026 16:54:42 +0000 by joshmpratt

AtCoder Beginner Contest 005 Solutions

Problem A Given two positive integers \(x\) and \(y\), compute \(\left\lfloor \frac{y}{x} \right\rfloor\). Problem B Given a sequence of integers \(a_1, a_2, \ldots, a_n\), output the minimum value among them. Problem C Problem Statement Each takoyaki remains fresh for exactly \(T\) seconds after being cooked. There are \(N\) takoyakis cooked a ...

Posted on Fri, 02 Oct 2026 16:15:08 +0000 by mmonaco

Solutions and Analysis for AtCoder Beginner Contest 311

A - First ABC The problem requires identifying the minimum 1-indexed position within a given string S where the characters 'A', 'B', and 'C' have all appeared at least once. The string length N is also provided. To solve this, we can iterate through the string from its beginning. As we process each character, we need a way to track whether 'A', ...

Posted on Mon, 28 Sep 2026 16:13:09 +0000 by cpd259