#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int mass[100] = {0};
  int n, m;
  int i;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &mass[i]);
  }
  scanf("%d", &m);
  for (i = 0; i < m; i++) {
    int flag[100] = {0};
    int d;
    scanf("%d", &d);
    while (d > 0 && d < n && mass[d] != 0 && flag[d] == 0) {
      flag[d] = 1;
      d += mass[d];
    }
    if (d == n - 1) {
      puts("Yes");
    } else {
      puts("No");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x350,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x1a0(%rbp),%rdi
xor    %esi,%esi
mov    $0x190,%edx
call   1040 <memset@plt>
lea    0xea4(%rip),%rdi
lea    -0x1a4(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x0,-0x1ac(%rbp)
mov    -0x1ac(%rbp),%eax
cmp    -0x1a4(%rbp),%eax
jge    11b9 <main+0x89>
movslq -0x1ac(%rbp),%rax
lea    -0x1a0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe60(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x1ac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1ac(%rbp)
jmp    1172 <main+0x42>
lea    0xe40(%rip),%rdi
lea    -0x1a8(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x0,-0x1ac(%rbp)
mov    -0x1ac(%rbp),%eax
cmp    -0x1a8(%rbp),%eax
jge    1303 <main+0x1d3>
lea    -0x340(%rbp),%rdi
xor    %esi,%esi
mov    $0x190,%edx
call   1040 <memset@plt>
lea    0xdfe(%rip),%rdi
lea    -0x344(%rbp),%rsi
call   1050 <scanf@plt>
xor    %eax,%eax
cmpl   $0x0,-0x344(%rbp)
mov    %al,-0x345(%rbp)
jle    1272 <main+0x142>
mov    -0x344(%rbp),%ecx
xor    %eax,%eax
cmp    -0x1a4(%rbp),%ecx
mov    %al,-0x345(%rbp)
jge    1272 <main+0x142>
movslq -0x344(%rbp),%rcx
xor    %eax,%eax
cmpl   $0x0,-0x1a0(%rbp,%rcx,4)
mov    %al,-0x345(%rbp)
je     1272 <main+0x142>
movslq -0x344(%rbp),%rax
cmpl   $0x0,-0x340(%rbp,%rax,4)
sete   %al
mov    %al,-0x345(%rbp)
mov    -0x345(%rbp),%al
test   $0x1,%al
jne    1285 <main+0x155>
jmp    12b6 <main+0x186>
movslq -0x344(%rbp),%rax
movl   $0x1,-0x340(%rbp,%rax,4)
movslq -0x344(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%eax
add    -0x344(%rbp),%eax
mov    %eax,-0x344(%rbp)
jmp    120e <main+0xde>
mov    -0x344(%rbp),%eax
mov    -0x1a4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    12de <main+0x1ae>
lea    0xd2f(%rip),%rdi
call   1030 <puts@plt>
jmp    12ea <main+0x1ba>
lea    0xd22(%rip),%rdi
call   1030 <puts@plt>
jmp    12ef <main+0x1bf>
mov    -0x1ac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1ac(%rbp)
jmp    11d6 <main+0xa6>
xor    %eax,%eax
add    $0x350,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x338,%rsp
lea    0x1a0(%rsp),%rbx
mov    $0x190,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
lea    0xea1(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    119d <main+0x6d>
xor    %ebp,%ebp
lea    0xe87(%rip),%r14
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
add    $0x1,%rbp
movslq 0x4(%rsp),%rax
add    $0x4,%rbx
cmp    %rax,%rbp
jl     1180 <main+0x50>
lea    0xe5c(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    124a <main+0x11a>
xor    %ebp,%ebp
lea    0x10(%rsp),%r14
lea    0xe39(%rip),%r15
lea    0x8(%rsp),%r13
lea    0xe30(%rip),%r12
lea    0xe2d(%rip),%rbx
jmp    11fa <main+0xca>
nopl   0x0(%rax)
add    $0xffffffff,%eax
cmp    %eax,%ecx
mov    %rbx,%rdi
cmove  %r12,%rdi
call   1030 <puts@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jge    124a <main+0x11a>
mov    $0x190,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
mov    %r15,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
mov    0x8(%rsp),%ecx
test   %ecx,%ecx
jle    11e0 <main+0xb0>
cmp    %eax,%ecx
jge    11e0 <main+0xb0>
mov    %ecx,%edx
mov    0x1a0(%rsp,%rdx,4),%esi
test   %esi,%esi
je     11e0 <main+0xb0>
cmpl   $0x0,0x10(%rsp,%rdx,4)
jne    11e0 <main+0xb0>
movl   $0x1,0x10(%rsp,%rdx,4)
add    %esi,%ecx
mov    %ecx,0x8(%rsp)
jg     1220 <main+0xf0>
jmp    11e0 <main+0xb0>
xor    %eax,%eax
add    $0x338,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"Yes\00"
@.str.2 = [3 x i8] c"No\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [100 x i32]
%7 = alloca i32
store i32 0, i32* %1
%8 = bitcast [100 x i32]* %2 to i8*
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 0, i32* %5
br label %10
10: ; preds = %19, %0
%11 = load i32, i32* %5
%12 = load i32, i32* %3
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %22
14: ; preds = %10
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %16
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %17)
br label %19
19: ; preds = %14
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %10
22: ; preds = %10
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
store i32 0, i32* %5
br label %24
24: ; preds = %72, %22
%25 = load i32, i32* %5
%26 = load i32, i32* %4
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %75
28: ; preds = %24
%29 = bitcast [100 x i32]* %6 to i8*
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
br label %31
31: ; preds = %52, %28
%32 = load i32, i32* %7
%33 = icmp sgt i32 %32, 0
br i1 %33, label %34, label %50
34: ; preds = %31
%35 = load i32, i32* %7
%36 = load i32, i32* %3
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %50
38: ; preds = %34
%39 = load i32, i32* %7
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %40
%42 = load i32, i32* %41
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %50
44: ; preds = %38
%45 = load i32, i32* %7
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %46
%48 = load i32, i32* %47
%49 = icmp eq i32 %48, 0
br label %50
50: ; preds = %44, %38, %34, %31
%51 = phi i1 [ false, %38 ], [ false, %34 ], [ false, %31 ], [ %49, %44 ]
br i1 %51, label %52, label %62
52: ; preds = %50
%53 = load i32, i32* %7
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %54
store i32 1, i32* %55
%56 = load i32, i32* %7
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %57
%59 = load i32, i32* %58
%60 = load i32, i32* %7
%61 = add nsw i32 %60, %59
store i32 %61, i32* %7
br label %31
62: ; preds = %50
%63 = load i32, i32* %7
%64 = load i32, i32* %3
%65 = sub nsw i32 %64, 1
%66 = icmp eq i32 %63, %65
br i1 %66, label %67, label %69
67: ; preds = %62
%68 = call i32 @puts(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %71
69: ; preds = %62
%70 = call i32 @puts(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %71
71: ; preds = %69, %67
br label %72
72: ; preds = %71
%73 = load i32, i32* %5
%74 = add nsw i32 %73, 1
store i32 %74, i32* %5
br label %24
75: ; preds = %24
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"Yes\00"
@.str.2 = [3 x i8] c"No\00"
define i32 @main() {
%1 = alloca [100 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = alloca [100 x i32]
%5 = alloca i32
%6 = bitcast [100 x i32]* %1 to i8*
%7 = bitcast i32* %2 to i8*
%8 = bitcast i32* %3 to i8*
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %20
12: ; preds = %0, %12
%13 = phi i64 [ %16, %12 ], [ 0, %0 ]
%14 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %13
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %14)
%16 = add nuw nsw i64 %13, 1
%17 = load i32, i32* %2
%18 = sext i32 %17 to i64
%19 = icmp slt i64 %16, %18
br i1 %19, label %12, label %20
20: ; preds = %12, %0
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%22 = load i32, i32* %3
%23 = icmp sgt i32 %22, 0
br i1 %23, label %24, label %59
24: ; preds = %20
%25 = bitcast [100 x i32]* %4 to i8*
%26 = bitcast i32* %5 to i8*
br label %27
27: ; preds = %24, %50
%28 = phi i32 [ 0, %24 ], [ %56, %50 ]
%29 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%30 = load i32, i32* %2
%31 = load i32, i32* %5
%32 = icmp sgt i32 %31, 0
%33 = icmp slt i32 %31, %30
%34 = select i1 %32, i1 %33, i1 false
br i1 %34, label %35, label %50
35: ; preds = %27, %45
%36 = phi i32 [ %46, %45 ], [ %31, %27 ]
%37 = zext i32 %36 to i64
%38 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %37
%39 = load i32, i32* %38
%40 = icmp eq i32 %39, 0
br i1 %40, label %50, label %41
41: ; preds = %35
%42 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 %37
%43 = load i32, i32* %42
%44 = icmp eq i32 %43, 0
br i1 %44, label %45, label %50
45: ; preds = %41
store i32 1, i32* %42
%46 = add nsw i32 %39, %36
store i32 %46, i32* %5
%47 = icmp sgt i32 %46, 0
%48 = icmp slt i32 %46, %30
%49 = select i1 %47, i1 %48, i1 false
br i1 %49, label %35, label %50
50: ; preds = %41, %35, %45, %27
%51 = phi i32 [ %31, %27 ], [ %46, %45 ], [ %36, %35 ], [ %36, %41 ]
%52 = add nsw i32 %30, -1
%53 = icmp eq i32 %51, %52
%54 = select i1 %53, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%55 = call i32 @puts(i8* dereferenceable(1) %54)
%56 = add nuw nsw i32 %28, 1
%57 = load i32, i32* %3
%58 = icmp slt i32 %56, %57
br i1 %58, label %27, label %59
59: ; preds = %50, %20
ret i32 0
}