Codeforces Round 1124 (Div. 2)

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
2269 Codeforces Round 1124 (Div. 2) FINISHED False 9000 1005916 Sept. 26, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 11624 ) B KiaKio and Squared Numbers PROGRAMMING brute force implementation

Kia and Kio spent the summer at the port of Mehragan, where (n) lighthouses stand on the cliffs facing the dark sea. The lighthouses of Mehragan do not give light. Every night a number is written in fire on each of them, and the sailors read their way from those numbers. The law of the lighthouses is this: if a lighthouse shows (x) tonight, then tomorrow night it shows the sum of the squares of the decimal digits of (x). For example, a lighthouse showing (23) will show (2^2+3^2=13) tomorrow, then (1^2+3^2=10), and then (1). On night (0) of the season, lighthouse (i) shows the number (a_i). From that night on, the law is applied once every night, forever. Kio calls two lighthouses (i) and (j) in tune if there exists a night after which, forever , both of them show exactly the same number on every single night. Kia asks: how many pairs ((i, j)) with (i \lt j) are in tune? Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 1000)). The description of the test cases follows. Each test case consists of two lines. The first line of each test case contains a single integer (n) ((1 \le n \le 1000)) — the number of lighthouses. The second line contains (n) integers (a_1, a_2, \ldots, a_n) ((1 \le a_i \le 10^9)) — the number shown by each lighthouse on night (0). It is guaranteed that the sum of (n) over all test cases does not exceed (1000). For each test case, print a single integer — the number of pairs ((i, j)) with (i \lt j) such that lighthouses (i) and (j) are in tune. In the first test case: Lighthouse (1) starts at (7): (7 \to 49 \to 97 \to 130 \to 10 \to 1), and it stays at (1) forever. Lighthouses (2) and (4) both start at (4), so they show the same number on every night. Lighthouse (3) starts at (16) and lighthouse (5) starts at (2); each of them

Tutorials

157140

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
392220592 PlievD B Sept. 26, 2026, 4:12 p.m. OK C# 13 TESTS 10 62 819200
392256157 I_SavyaSachi B Sept. 26, 2026, 9:24 p.m. OK C++17 (GCC 7-32) TESTS 10 15 0
392238229 caser. B Sept. 26, 2026, 5:37 p.m. OK C++17 (GCC 7-32) TESTS 10 15 0
392212259 ayushkala16 B Sept. 26, 2026, 3:47 p.m. OK C++17 (GCC 7-32) TESTS 10 15 0
392288137 YGODK B Sept. 27, 2026, 5:57 a.m. OK C++17 (GCC 7-32) TESTS 10 31 0
392284365 trappedui B Sept. 27, 2026, 5:18 a.m. OK C++17 (GCC 7-32) TESTS 10 31 0
392283604 heytherefriedn123 B Sept. 27, 2026, 5:07 a.m. OK C++17 (GCC 7-32) TESTS 10 31 0
392283347 abhi_yo B Sept. 27, 2026, 5:03 a.m. OK C++17 (GCC 7-32) TESTS 10 31 0
392282909 shuiqideren B Sept. 27, 2026, 4:55 a.m. OK C++17 (GCC 7-32) TESTS 10 31 0
392282557 Saidul_1 B Sept. 27, 2026, 4:49 a.m. OK C++17 (GCC 7-32) TESTS 10 31 0
392279786 stelitzia B Sept. 27, 2026, 3:56 a.m. OK C++17 (GCC 7-32) TESTS 10 31 0
392254799 brenner1 B Sept. 26, 2026, 8:56 p.m. OK C++20 (GCC 13-64) TESTS 10 15 0
392229236 reshilkin B Sept. 26, 2026, 4:45 p.m. OK C++20 (GCC 13-64) TESTS 10 15 0
392217308 pisini_Ramana B Sept. 26, 2026, 4:02 p.m. OK C++20 (GCC 13-64) TESTS 10 15 0
392284363 ycy17 B Sept. 27, 2026, 5:18 a.m. OK C++20 (GCC 13-64) TESTS 10 31 0
392283454 Darshik B Sept. 27, 2026, 5:04 a.m. OK C++20 (GCC 13-64) TESTS 10 31 0
392282559 Meysam B Sept. 27, 2026, 4:49 a.m. OK C++20 (GCC 13-64) TESTS 10 31 0
392281994 sarthaksawant25 B Sept. 27, 2026, 4:39 a.m. OK C++20 (GCC 13-64) TESTS 10 31 0
392281533 skygeon B Sept. 27, 2026, 4:30 a.m. OK C++20 (GCC 13-64) TESTS 10 31 0
392281386 gwd B Sept. 27, 2026, 4:27 a.m. OK C++20 (GCC 13-64) TESTS 10 31 0
392280577 giaminh2011 B Sept. 27, 2026, 4:11 a.m. OK C++20 (GCC 13-64) TESTS 10 31 0

remove filters

Back to search problems