Codeforces Round 1020 (Div. 3)

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
2106 Codeforces Round 1020 (Div. 3) FINISHED False 8100 30900323 April 24, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 36256 ) A Dr. TC PROGRAMMING brute force math

In order to test his patients' intelligence, Dr. TC created the following test. First, he creates a binary string(^{\text{∗}}) (s) having (n) characters. Then, he creates (n) binary strings (a_1, a_2, \ldots, a_n). It is known that (a_i) is created by first copying (s), then flipping the (i)'th character ((1) becomes (0) and vice versa). After creating all (n) strings, he arranges them into a grid where the (i)'th row is (a_i). For example, If (s = 101), (a = 001, 111, 100). If (s = 0000), (a = 1000, 0100, 0010, 0001). The patient needs to count the number of (1)s written on the board in less than a second. Can you pass the test? (^{\text{∗}})A binary string is a string that only consists of characters (1) and (0). The first line of the input consists of a single integer (t) ((1 \le t \le 1000)) — the number of test cases. The first line of each test case contains a single integer (n) ((1 \le n \le 10)) — the length of the binary string (s). The second line of each test case contains a single binary string (s) of size (n). For each test case, output a single integer, the number of (1)s on the board. The first example is explained in the statement. For the second example, the only string written on the board will be the string (0); therefore, the answer is (0). In the third example, the following strings will be written on the board: (10000, 01000, 00100, 00010, 00001); so there are five (1)s written on the board.

Tutorials

Codeforces Round 1020 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
317111046 oskirych A April 24, 2025, 10:31 p.m. OK C# 10 TESTS 2 61 0
317095190 ezooooo5.rappelz A April 24, 2025, 7:03 p.m. OK C# 10 TESTS 2 77 0
317085325 A1ternate A April 24, 2025, 5:37 p.m. OK C# 10 TESTS 2 78 0
317119255 gabriel.gom.cat A April 25, 2025, 1:39 a.m. OK C++17 (GCC 7-32) TESTS 2 15 0
317124297 lht006128 A April 25, 2025, 3:28 a.m. OK C++17 (GCC 7-32) TESTS 2 15 0
317120329 SangNi A April 25, 2025, 2:03 a.m. OK C++17 (GCC 7-32) TESTS 2 15 0
317123216 miracat A April 25, 2025, 3:07 a.m. OK C++17 (GCC 7-32) TESTS 2 15 204800
317133213 CST24045 A April 25, 2025, 5:46 a.m. OK C++17 (GCC 7-32) TESTS 2 30 0
317134306 flyingfist A April 25, 2025, 6:01 a.m. OK C++17 (GCC 7-32) TESTS 2 30 0
317133917 JSON_H A April 25, 2025, 5:56 a.m. OK C++17 (GCC 7-32) TESTS 2 30 0
317131417 Dikshith_200 A April 25, 2025, 5:20 a.m. OK C++17 (GCC 7-32) TESTS 2 30 0
317132448 rocky8474 A April 25, 2025, 5:35 a.m. OK C++17 (GCC 7-32) TESTS 2 30 0
317132352 richoo_cv A April 25, 2025, 5:33 a.m. OK C++17 (GCC 7-32) TESTS 2 30 0
317114378 bluemegane A April 24, 2025, 11:49 p.m. OK C# 8 TESTS 2 77 102400

remove filters

Back to search problems