PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#BF0000045. Bài toán ma trận (The Matrix Problem)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Bài toán ma trận (The Matrix Problem)
The Matrix Problem
Source: HDU
Version: Phuoc Hung OJ Extended
Problem Statement
Given a positive matrix and bounds , determine whether positive row multipliers and positive column divisors exist such that for every cell.
Input
First line , followed by the rows of integers each.
Output
Print YES or NO.
Subtasks
- Subtask 1 (20 points): , ; .
- Subtask 2 (30 points): , ; .
- Subtask 3 (50 points): , ; .
Examples
Input
3 3 1 6
2 3 4
8 2 6
5 2 9
Output
YES
Explanation
Choose row multipliers and column divisors . The transformed matrix has rows , , and . All entries lie in , so the answer is YES.