Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Error de compilación
Compilation time limit exceeded. |
||
#2 |
Error de compilación
Compilation time limit exceeded. |
||
#3 |
Correcto
|
0.091 s | 20 KBi |
#4 |
Correcto
|
0.08 s | 12 KBi |
#5 |
Error de compilación
Compilation time limit exceeded. |
||
#6 |
Error de compilación
Compilation time limit exceeded. |
||
#7 |
Correcto
|
0.093 s | 50 KBi |
#8 |
Error de compilación
Compilation time limit exceeded. |
||
#9 |
Tiempo límite excedido
|
0.559 s | 22 KBi |
#10 |
Tiempo límite excedido
|
0.548 s | 21 KBi |
#11 |
Tiempo límite excedido
|
0.52 s | 22 KBi |
#12 |
Tiempo límite excedido
|
0.631 s | 22 KBi |
#13 |
Tiempo límite excedido
|
0.518 s | 21 KBi |
#14 |
Tiempo límite excedido
|
0.62 s | 25 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, sum[], c; st = new StringTokenizer(br.readLine()); n = Integer.parseInt(st.nextToken()); sum = new int[n]; st = new StringTokenizer(br.readLine()); sum[0] = Integer.parseInt(st.nextToken()); for (int i = 1; i < sum.length; i++) { sum[i] = sum[i - 1] + Integer.parseInt(st.nextToken()); } st = new StringTokenizer(br.readLine()); c = Integer.parseInt(st.nextToken()); 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(sum[q]); } else { System.out.println(sum[q] - sum[p - 1]); } } } }