#BS0000454. Phán quyết công bằng (Gravamen)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Phán quyết công bằng (Gravamen)
Gravamen
Source: Kattis – https://open.kattis.com/problems/gravamen
Version: Phuoc Hung OJ Extended
Problem Statement
A judge must rule on lawsuits involving individuals and corporations, numbered separately starting from 1. Lawsuit involves individual and corporation . A pair may be involved in more than one lawsuit.
For every lawsuit, exactly one of its two parties must win. Minimize the largest number of wins of any single individual or corporation. Output any optimal set of rulings.
Input
The first line contains . Each of the next lines contains .
Output
Print exactly lines in input order. Line must contain INDV followed by , or CORP followed by , identifying the winner. Any optimal assignment is accepted. Do not print the optimum value separately.
Subtasks
Common conditions apply to all subtasks. Scoring groups are added by Phuoc Hung OJ.
; ; ; .
Each individual and corporation participates in at least one lawsuit. Repeated pairs are allowed. All input values are integers.
Subtask 1 (20 points)
- .
Subtask 2 (30 points)
- .
Subtask 3 (50 points)
- .
Examples
Example 1
Input
5 3 8
1 1
2 1
3 1
4 2
5 2
3 3
4 3
5 3
Output
INDV 1
INDV 2
CORP 1
INDV 4
CORP 2
INDV 3
CORP 3
INDV 5
Explanation
Each of the eight parties wins exactly once. The optimum cannot be zero, so the assignment is optimal.
Example 2
Input
1 1 4
1 1
1 1
1 1
1 1
Output
INDV 1
INDV 1
CORP 1
CORP 1
Explanation
Four lawsuits shared by two parties require at least two wins for one party. The sample gives each party two wins.