Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.FileReader;
- import java.util.ArrayList;
- import java.util.Collections;
- import java.util.Comparator;
- import java.util.Scanner;
- public class Solution {
- public static void main(String[] args) {
- try {
- String cad;
- Scanner s = new Scanner(System.in);
- String sCurrentLine;
- int T = 0;
- int i;
- int j;
- int np;
- boolean alice;
- String a = "Alice";
- String b = "Bob";
- ArrayList<Integer> ps = new ArrayList<>();
- while (s.hasNext()) {
- sCurrentLine = s.nextLine();
- T = Integer.parseInt(sCurrentLine);
- int G = 0;
- for (i = T - 1; i >= 0; --i) {
- sCurrentLine = s.nextLine();
- G = Integer.parseInt(sCurrentLine);
- np = 0;
- ps.clear();
- for (j = 0; j < G; j++) {
- sCurrentLine = s.nextLine();
- np = Integer.parseInt(sCurrentLine);
- sCurrentLine = s.nextLine();
- String[] p = sCurrentLine.split(" ");
- for (String c : p) {
- ps.add(Integer.valueOf(c));
- }
- }
- ////TODO////
- alice = false;
- Collections.reverse(ps);
- while (!(ps.get(0) == 1)) {
- ps.add(1);
- ps.add(1);
- ps.add(ps.get(0) - 2);
- ps.remove(0);
- Collections.reverse(ps);
- alice = !alice;
- }
- System.out.println(alice ? a : b);
- }
- }
- } catch (Exception e) {
- } finally {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement