Skip to content

Instantly share code, notes, and snippets.

@johirbuet
Created February 27, 2018 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johirbuet/057385b8a3206dd3dbb9e91134952cbb to your computer and use it in GitHub Desktop.
Save johirbuet/057385b8a3206dd3dbb9e91134952cbb to your computer and use it in GitHub Desktop.
import java.util.Scanner;
public class UVA12996 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
for(int t =1;t<=T;t++) {
int N = sc.nextInt();
int L = sc.nextInt();
int [] M = new int[N];
int [] C = new int[N];
int sum = 0;
for(int i =0; i< N; i++) {
M[i] = sc.nextInt();
sum += M[i];
}
for(int i = 0;i < N ; i++) {
C[i] = sc.nextInt();
}
boolean possible = true;
for(int i =0; i < N; i++) {
if(M[i] > C[i]) {
possible = false;
break;
}
}
possible = possible && (sum <= L);
System.out.println("Case "+t+": "+(possible?"Yes":"No"));
}
sc.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment