| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 (추가 시간 없음) | 1024 MB (추가 메모리 없음) | 158 | 31 | 25 | 21.930% |
You have a sequence $a$ of $N$ integers between 0ドル$ and $K$ inclusive. $M$ segments are given, where $i$th segment is $[l_i,r_i]$. We want $\sum_{j=l_i}^{r_i}a_j=K$ to satisfy for every segment. Determine whether there exists such sequence $a$.
Each test data contains one or more test cases. The first line contains an integer $T$ — the number of test cases for this input file.
First line of each test case contains 3ドル$ integers $N,ドル $M,ドル $K$.
$i$-th of the next $M$ lines contain two integers $l_i$ and $r_i$: left and right end of $i$-th segment.
For each test case, if a sequence that satisfies the condition exists, output the elements of the sequence. In case of multiple answers you may output any of them.
If no valid sequence exists, output a single integer $-1$.
4 6 3 3 1 3 2 4 3 5 4 6 2 1 2 1 3 1 4 2 3 2 4 3 4 4 4 1 1 2 3 4 1 3 2 4 3 3 10 1 1 2 2 3 3
1 1 1 1 1 1 -1 1 0 0 1 10 10 10
University > KAIST > KAIST ICPC Mock Competition > 2024 KAIST 14th ICPC Mock Competition K번