package no332; import java.util.ArrayList; import java.util.Collections; import java.util.Scanner; public class Main { public static final int MAX = 10000; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long x = sc.nextLong(); ArrayList a = new ArrayList<>(); //i,a for(int i=0;iInteger.compare(xx.a, yy.a)); int n2 = 0; int max2 = 0; for(Pair p:a) { if (p.a <= MAX) { n2++; max2 += p.a; }else{ break; } } boolean[][] dp = new boolean[n2+1][max2+1]; dp[0][0] = true; for(int i=1;i<=n2;i++) { int w = a.get(i-1).a; for(int j=max2;j>=0;j--) { if (j >= w) { dp[i][j] |= dp[i-1][j-w]; } dp[i][j] |= dp[i-1][j]; } } int n3 = n - n2; for(int i=0;i<1<>j&1)>0) { sum += a.get(n2 + j).a; } } if (sum > x) { continue; } if (x - sum <= max2 && dp[n2][(int) (x-sum)]) { boolean[] ans = new boolean[n]; for(int j=0;j>j&1)>0) { ans[a.get(n2+j).i] = true; } } int now = (int) (x - sum); for(int i2=n2;i2>=1;i2--) { int w = a.get(i2-1).a; if (now >= w && dp[i2-1][now-w]) { ans[a.get(i2-1).i] = true; now -= w; } } StringBuilder sb = new StringBuilder(); for(int j=0;j