Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.075 s | 10 KBi |
#2 |
Error de compilación
Compilation time limit exceeded. |
||
#3 |
Correcto
|
0.074 s | 10 KBi |
#4 |
Correcto
|
0.075 s | 10 KBi |
#5 |
Correcto
|
0.104 s | 23 KBi |
#6 |
Error de compilación
Compilation time limit exceeded. |
||
#7 |
Correcto
|
0.09 s | 16 KBi |
#8 |
Correcto
|
0.318 s | 16 KBi |
#9 |
Correcto
|
0.64 s | 27 KBi |
#10 |
Correcto
|
0.638 s | 27 KBi |
#11 |
Correcto
|
0.664 s | 30 KBi |
#12 |
Correcto
|
0.637 s | 29 KBi |
#13 |
Correcto
|
0.822 s | 29 KBi |
#14 |
Tiempo límite excedido
|
0.643 s | 24 KBi |
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; class Main{ public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st; int n, p,q, c; long A[]; //st = new StringTokenizer(br.readLine()); n = Integer.parseInt(br.readLine()); A = new long[n]; st = new StringTokenizer(br.readLine()); A[0] = Long.parseLong(st.nextToken()); for (int i = 1; i < A.length; i++) { A[i] = A[i - 1] + Long.parseLong(st.nextToken()); } //st = new StringTokenizer(br.readLine()); c = Integer.parseInt(br.readLine()); for (int i = 0; i < c; i++) { st = new StringTokenizer(br.readLine()); p = Integer.parseInt(st.nextToken()); q = Integer.parseInt(st.nextToken()); if (p == 0) { System.out.println(A[q]); } else { System.out.println(A[q] - A[p - 1]); } } } }