HIIT Open 2016

 Start: 2016-05-28 11:00:00 End: 2016-05-28 16:00:00

CSES - HIIT Open 2016 - Results
History
2016-05-28 15:00:25
2016-05-28 13:39:35
2016-05-28 13:09:34
 Task: Graph painting Sender: Verto Submission time: 2016-05-28 13:39:35 Language: Java Status: READY Result: TIME LIMIT EXCEEDED

Test results

 test verdict time (s) #1 ACCEPTED 0.23 / 1.00 details #2 ACCEPTED 0.18 / 1.00 details #3 TIME LIMIT EXCEEDED -- / 1.00 details

Code

```import java.util.Vector;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.List;

public class G {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
for(int i = 0; i < t; i++) {
int n = sc.nextInt();
int m = sc.nextInt();
Vector<Node> nodes = new Vector<Node>(n);
for(int j=0; j<n; j++)

for(int j=0; j<m; j++) {
int u = sc.nextInt() - 1;
int v = sc.nextInt() - 1;
nodes.get(u).connect(nodes.get(v));
}
for(Node node : nodes) {
int n_red = 0;
int n_blue = 0;
for(Node neigh : node.neighbors) {
if(neigh.color == 'R')
n_red += 1;
else if(neigh.color == 'B')
n_blue += 1;
}
if(n_red > n_blue)
node.color = 'B';
else
node.color = 'R';
System.out.print(node.color + " ");
}
System.out.println();
}
}

}

class Node {
public List<Node> neighbors;
public int name;
public char color;
public Node(int name) {
this.name = name;
this.neighbors = new ArrayList<Node>();
this.color = '-';
}
public void connect(Node other) {
}
}
```

Test details

Test 1

Verdict: ACCEPTED

input
```100 7 1 2 5 8 28 2 7 6 7 4 6 2 3 3 5 7 8 4 8 5 7 5 6 4 7 6 8 1 4 2 6 4 5 3 8 2 8 ...```
view   save

correct output
```B R B B B B R R B B R B R B B R R B B B B R R R B B B R B R B B B B R B R R B R B R B B B B R B R B R B B B R B R B R B R R B R B R R R R R B B R B R R R R B R R R R B B R R R B B B R B R R R R B R B B B R B R B B R R B R B B B R R ...```
view   save

user output
```R R R R B R R R B R B R B R B R B R B R R R R B R R B R B R B R B B R R R B B R R R B R R B B R B R B R R R B R B R B R B R B R R B R B R B R B R R R B B R R R B R B R R R R B B R B R R B B R R R B R B B R B R R B R B B R R R R B R ...```
view   save

Test 2

Verdict: ACCEPTED

input
```10 38 36 18 28 20 37 22 38 17 33 17 30 26 34 12 37 1 18 36 37 33 34 24 34 18 22 3 11 3 28 29 33 16 35 25 38 10 23 ...```
view   save

correct output
```R R B R B R R R R R B B R B R ... R R B B B R R B R B R B R B R ... B B R R R R B R B B B R R B R ... R R B R B B R B B R R R B B B B R B B B R R ... R R B B R R R B R R B R R R B ... B R R B R B B B R R R R B B R R B B B R R B R B B B B B ... R R B R R R R R B R B B R R R ... R R B R B B R R B R B B B R B ...```
view   save

user output
```R R R R R R R R R R B R R R R ... R R R R R B R R R R R R R B R ... R R R R R R R R R R R R R R R ... R B R R B B R R R R R R R R R R R R R R B R ... R B R R R R R R R R R B R B B ... R R R R R B B R R B R R B R R R R R R R R R R R R R R R ... R R R R R R R R R R R R R R R ... R R R R R R R B R R R R B R B ...```
view   save

Test 3

Verdict: TIME LIMIT EXCEEDED

input
```1 100000 200000 89300 98492 33853 56822 92967 99427 42461 62590 20195 38987 80870 85808 20624 64006 62088 88344 8872 92190 42562 66966 12882 52315 1520 96552 45353 90886 94940 99227 53663 62317 43160 66687 93275 93293 97160 97656 ...```
view   save

correct output
`R R R R B R R R B B B R B B B ...`
view   save

user output
(no output)
view   save