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.
Problems
B"You are asked to build an array a , consisting of n integers, each element should be from 1 to k . The array should be non-decreasing ( a_i <= a_{i+1} for all i from 1 to n-1 ). You are also given additional constraints on it. Each constraint is of one of three following types: Build any non-decreasing array that satisfies all constraints or report that no such array exists. The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of testcases. The first line of each testcase contains three integers n, m and k ( 2 <= n <= 2 cdot 10^4 ; 0 <= m <= 2 cdot 10^4 ; 2 <= k <= 10 ). The i -th of the next m lines contains a description of a constraint. Each constraint is of one of three following types: The sum of n over all testcases doesn't exceed 2 cdot 10^4 . The sum of m over all testcases doesn't exceed 2 cdot 10^4 . For each testcase, determine if there exists a non-decreasing array that satisfies all conditions. If there is no such array, then print -1. Otherwise, print any valid array -- n integers from 1 to k . "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
160387250 |
themoon |
F |
June 13, 2022, 1:18 a.m. |
OK |
GNU C++14 |
TESTS |
45 |
109 |
35328000 |
|
|
160398925 |
peiwenjun |
F |
June 13, 2022, 5:49 a.m. |
OK |
GNU C++14 |
TESTS |
45 |
140 |
32460800 |
|
|
160391158 |
DangPhuDuy |
F |
June 13, 2022, 3:13 a.m. |
OK |
GNU C++14 |
TESTS |
45 |
264 |
56832000 |
|
|
160368962 |
AlmostComplete |
F |
June 12, 2022, 5:45 p.m. |
OK |
GNU C++14 |
TESTS |
45 |
826 |
364544000 |
|
|
160379319 |
humbertoyusta |
F |
June 12, 2022, 8:20 p.m. |
OK |
GNU C++17 |
TESTS |
45 |
218 |
70963200 |
|
|
160379280 |
Ant_Man |
F |
June 12, 2022, 8:19 p.m. |
OK |
GNU C++17 |
TESTS |
45 |
280 |
37785600 |
|
|
160383720 |
_LeMur_ |
F |
June 12, 2022, 10:28 p.m. |
OK |
GNU C++17 |
TESTS |
45 |
311 |
44748800 |
|
|
160378262 |
chemthan |
F |
June 12, 2022, 7:57 p.m. |
OK |
GNU C++17 |
TESTS |
45 |
327 |
121856000 |
|
|
160384704 |
prokopton |
F |
June 12, 2022, 11:15 p.m. |
OK |
GNU C++17 (64) |
TESTS |
45 |
171 |
106496000 |
|
|
160388462 |
e3c8f1a924 |
F |
June 13, 2022, 1:59 a.m. |
OK |
GNU C++17 (64) |
TESTS |
45 |
171 |
129228800 |
|
|
160387987 |
tzxydby |
F |
June 13, 2022, 1:44 a.m. |
OK |
GNU C++17 (64) |
TESTS |
45 |
218 |
83660800 |
|
|
160379467 |
Ant_Man |
F |
June 12, 2022, 8:23 p.m. |
OK |
GNU C++17 (64) |
TESTS |
45 |
295 |
65024000 |
|
|
160365066 |
SSRS_ |
F |
June 12, 2022, 5:10 p.m. |
OK |
GNU C++17 (64) |
TESTS |
45 |
311 |
68505600 |
|
|
160397530 |
xiaoziyao |
F |
June 13, 2022, 5:24 a.m. |
OK |
GNU C++17 (64) |
TESTS |
45 |
327 |
76800000 |
|
|
160381998 |
Thienu |
F |
June 12, 2022, 9:28 p.m. |
OK |
GNU C++17 (64) |
TESTS |
45 |
358 |
89702400 |
|
|
160370408 |
HIR180 |
F |
June 12, 2022, 6:01 p.m. |
OK |
GNU C++17 (64) |
TESTS |
45 |
608 |
306278400 |
|
|
160369931 |
HIR180 |
F |
June 12, 2022, 5:56 p.m. |
OK |
GNU C++17 (64) |
TESTS |
45 |
670 |
306278400 |
|
|
160378604 |
emorgan5289 |
F |
June 12, 2022, 8:05 p.m. |
OK |
GNU C++20 (64) |
TESTS |
45 |
171 |
95948800 |
|
|
160379535 |
timmyfeng |
F |
June 12, 2022, 8:25 p.m. |
OK |
GNU C++20 (64) |
TESTS |
45 |
186 |
69324800 |
|
|
160391392 |
vanhjjsdj |
F |
June 13, 2022, 3:18 a.m. |
OK |
GNU C++20 (64) |
TESTS |
45 |
327 |
88371200 |
|
|
160387865 |
LukexMylinh |
F |
June 13, 2022, 1:39 a.m. |
OK |
GNU C++20 (64) |
TESTS |
45 |
358 |
90112000 |
|
|
160377154 |
SSerxhs |
F |
June 12, 2022, 7:37 p.m. |
OK |
GNU C++20 (64) |
TESTS |
45 |
405 |
165273600 |
|
|
160376784 |
SSerxhs |
F |
June 12, 2022, 7:31 p.m. |
OK |
GNU C++20 (64) |
TESTS |
45 |
421 |
165273600 |
|
|
160394200 |
Nea1 |
F |
June 13, 2022, 4:21 a.m. |
OK |
GNU C++20 (64) |
TESTS |
45 |
592 |
155136000 |
|
|
160376931 |
zidder |
F |
June 12, 2022, 7:33 p.m. |
OK |
GNU C++20 (64) |
TESTS |
45 |
1013 |
98406400 |
|
|
160361689 |
sansen |
F |
June 12, 2022, 4:48 p.m. |
OK |
Rust 2021 |
TESTS |
45 |
124 |
56729600 |
|
|
remove filters
Back to search problems