Solutions are presented as using the least memory and the fastest execution time. It also takes the top 10 most recent solutions from each language. If you want to limit to a specific index, click the "Solved" button and go to that problem.
ContestId |
Name |
Phase |
Frozen |
Duration (Seconds) |
Relative Time |
Start Time |
|---|---|---|---|---|---|---|
| 2231 | Codeforces Round 1099 (Div. 2) | FINISHED | False | 7200 | 2129080 | May 21, 2026, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 23076 ) | A | Construct an Array | PROGRAMMING | constructive algorithms |
You are given an integer (n). You need to construct an array of integers (a_1, a_2, \ldots, a_n) such that the following conditions are satisfied: (1 \leq a_i \leq 2 \cdot n) for all (i) from (1) to (n). All elements of the array and the sums of adjacent elements are pairwise distinct. In other words, among the numbers (\{a_1, a_2, \ldots, a_n, a_1 + a_2, a_2 + a_3, \ldots, a_{n - 1} + a_n\}), there should not be two equal numbers. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 100)). The description of the test cases follows. The only line of each test case contains one integer (n) ((1 \le n \le 500)). For each test case, output an array of length (n) that satisfies the condition of the problem. It can be shown that such an array always exists under the given constraints. In the second example, all elements and adjacent sums form the set (\textbf{6}, \textbf{2}, \textbf{3}, 8, 5), all of whose elements are distinct. In the third example, all elements and adjacent sums form the set (\textbf{8}, \textbf{1}, \textbf{11}, \textbf{2}, \textbf{3}, \textbf{4}, 9, 12, 13, 5, 7), whose elements are also distinct. |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 375549956 | forchange | A | May 21, 2026, 4:33 p.m. | OK | C# 13 | TESTS | 4 | 109 | 14131200 |
Back to search problems