## TLE '16 Contest 7 P3 - NOR

View as PDF

Points: 10 (partial)
Time limit: 0.75s
Memory limit: 256M

Author:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
A Venn diagram of from the Wikimedia Commons.

The only required knowledge is the operator. All of its possible outputs can be stored concisely in this table.

You are given a sequence consisting of 's and 's. Here, the element of is denoted with . has length , and is indexed from to .

There are queries, with each query consisting of integers and . For each query, output the value of by itself on a line. Because the operator is not associative, please evaluate the operations from left to right.

#### Input Specification

The first line contains one integer, .

The second line contains space-separated integers. The integer is .

The third line contains one integer, .

The following lines contain two space-separated integers, and .

Subtask Points Additional Constraints
1 20 ,
2 20 ,
3 60 No additional constraints.

#### Output Specification

For each query, output the result of . The operations should be evaluated from left to right.

#### Sample Input

6
0 1 1 0 0 1
5
1 2
2 6
3 5
4 5
5 6

#### Sample Output

0
0
1
1
0

## Comments

• commented on March 24, 2017, 9:29 a.m.

How come when input is 3 5, and the A string is 0 1 1 0 0 1 the output is 1? It should process 1 0 0 which gives a value of 0 when processed with nor?

• commented on March 24, 2017, 9:38 a.m.