sHaHriAr_17s | Logout
HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP
PROBLEMS SUBMIT CODE MY SUBMISSIONS STATUS HACKS ROOM STANDINGS CUSTOM INVOCATION
Codeforces Round 1066 (Div. 1 +
C. Meximum Array 2 Div. 2)
time limit per test: 2 seconds Contest is running
memory limit per test: 256 megabytes 00:56:20
Ferus Melek - Brute Force Contestant
⠀
You are given three positive integers n, k , and q . You are also given q tuples (c, l, r), with 1 ≤ c ≤ 2 and 1 ≤ l ≤ r ≤ n .
9
An array a1 , a2 , … , an is meximum if 0 ≤ ai ≤ 10 for each i in [1, n] , and for each given tuple (c, l, r),
→ Submit?
if c = 1 , then min(al , al+1 , … , ar ) = k;
if c = 2 , then MEX (al , al+1 , … , ar ) = k.
∗ Language: GNU G++23 14.2 (64 bit, m
Choose
Note that the parameter k is the same for all the conditions. file:
Choose File No file chosen
Be careful: there is 50 points penalty for
Find a meximum array a1 , a2 , … , an of length n. The input is generated in such a way that a valid array always exists. If there are submission which fails the pretests or
multiple possible arrays, you can print any one of them. resubmission (except failure on the first test,
denial of judgement or similar verdicts).
"Passed pretests" submission verdict doesn't
∗
The minimum excluded (MEX) of a collection of integers a 1 , a 2 , … , a k is defined as the smallest non-negative integer x which does not occur in the collection a .
guarantee that the solution is absolutely
Input correct and it will pass system tests.
Each test contains multiple test cases. The first line contains the number of test cases t (1 ≤ t ≤ 500 ). The description of the test cases
Submit
follows.
The first line of each test case contains three integers n, k , q (1 ≤ k ≤ n ≤ 100 , 1 ≤ q ≤ 100 ) — the length of the array
a1 , a2 , … , an , the result of the min and MEX calculations described by the tuples, and the number of tuples. → Score table
Then, q lines follow. The i -th line contains a tuple (c, l, r), which gives a constraint to al , al+1 , … , ar according to the statement. Score
Problem A 396
It is guaranteed that there exists a valid array corresponding to the given input.
Problem B 792
Note that there are no constraints on the sum of n, k , or q over all test cases. Problem C 1188
Problem D 1188
Output
For each test case, print a single line containing a meximum array a1 , a2 , … , an . Problem E 1584
Problem F 1980
Example
Problem G 2376
input Copy
Problem H 2970
4
6 2 2 Problem I 3168
1 1 3 Successful hack 100
2 2 6
3 3 1 Unsuccessful hack -50
2 1 3
Unsuccessful submission -50
3 3 2
1 1 1 Resubmission -50
1 3 3 * If you solve problem on 01:18 from the first attempt
3 2 2
2 1 2
2 2 3
output Copy
2 5 4 3 0 1
2 0 1
3 3 3
1 0 1
Note
In the first test case, you have to build a meximum array with n = 6 ,k = 2 and with q = 2 constraints given by tuples.
tuple (1, 1, 3) : min(a1 , a2 , a3 ) must be 2;
tuple (2, 2, 6) : MEX(a2 , a3 , a4 , a5 , a6 ) must be 2.
9
A possible array that satisfies all these constraints, and has elements 0 ≤ ai ≤ 10 , is [2, 5, 4, 3, 0, 1].
In the second test case, you have to build a meximum array with n = 3 ,k = 3 and with q = 1 constraint given by a tuple.
tuple (2, 1, 3) : MEX(a1 , a2 , a3 ) must be 3.
9
A possible array that satisfies this constraint, and has elements 0 ≤ ai ≤ 10 , is [2, 0, 1].
Codeforces (c) Copyright 2010-2025 Mike Mirzayanov
The only programming contests Web 2.0 platform
Server time: Nov/23/2025 16:53:19UTC+6 (k3).
Desktop version, switch to mobile version.
Privacy Policy | Terms and Conditions
Supported by