import java.util.*; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int friend[]=new int[n]; int enemy[]=new int[n]; for(int i=0;iQ=new PriorityQueue<>(); int times[]=new int[n]; for(int j=0;j=n)Enum-=n; conect x=Q.poll(); int y=x.l+enemy[Enum]/2; times[x.n]++; Q.add(new conect(y,times[x.n],x.n)); } int ansk=0; for(int j=0;j { int l; int t; int n; public conect(int l, int t, int n) { this.l = l; this.t = t; this.n = n; } public conect() { } @Override public int compareTo(conect o) { if(this.l!=o.l) return this.l - o.l; return this.t-o.t; } }