PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#BF0000037. Quy hoạch công trình (Engineering Planning)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Quy hoạch công trình (Engineering Planning)
Engineering Planning
Source: Luogu
Version: Phuoc Hung OJ Extended
Problem Statement
There are tasks with nonnegative integer start times . Each relation requires . Output any satisfying schedule with minimum start time equal to , or NO SOLUTION if infeasible.
An output assignment is valid if it satisfies all constraints.
Input
First line , followed by lines .
Output
Print NO SOLUTION if impossible; otherwise print lines containing start times .
Subtasks
- Subtask 1 (20 points): $5\le n\le12; 5\le m\le30; 1\le i,j\le n; -99\le b\le99$.
- Subtask 2 (30 points): $5\le n\le200; 5\le m\le1000; 1\le i,j\le n; -99\le b\le99$.
- Subtask 3 (50 points): $5\le n\le1000; 5\le m\le5000; 1\le i,j\le n; -99\le b\le99$.
Examples
Input
5 5
1 2 0
1 5 -1
2 5 1
3 1 5
4 1 4
Output
0
1
1
1
1
Explanation
The condition forces . One feasible schedule is , satisfying all five inequalities. The checker accepts any feasible normalized schedule.