Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Incorrecto
|
0.098 s | 13 KBi |
#2 |
Incorrecto
|
0.094 s | 12 KBi |
#3 |
Incorrecto
|
0.108 s | 12 KBi |
#4 |
Incorrecto
|
0.089 s | 12 KBi |
#5 |
Incorrecto
|
0.102 s | 12 KBi |
#6 |
Incorrecto
|
0.109 s | 12 KBi |
#7 |
Incorrecto
|
0.111 s | 12 KBi |
#8 |
Incorrecto
|
0.504 s | 24 KBi |
#9 |
Tiempo límite excedido
|
1.08 s | 27 KBi |
#10 |
Tiempo límite excedido
|
1.05 s | 23 KBi |
#11 |
Tiempo límite excedido
|
1.064 s | 27 KBi |
#12 |
Tiempo límite excedido
|
1.027 s | 24 KBi |
#13 |
Incorrecto
|
0.438 s | 24 KBi |
#14 |
Tiempo límite excedido
|
1.077 s | 28 KBi |
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; public class Main { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader s = new BufferedReader(new InputStreamReader(System.in)); BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); int n = Integer.parseInt(s.readLine()); String[] numsS = s.readLine().split(" "); int[] nums = new int[n]; for (int i = 0; i < n; i++) { nums[i] = Integer.parseInt(numsS[i]); } int queries = Integer.parseInt(s.readLine()); for (int i = 0; i < queries; i++) { String[] line = s.readLine().split(" "); int start = Integer.parseInt(line[0]); int end = Integer.parseInt(line[1]); int sum = 0; for (int j = start; j <= end; j++) { sum += nums[j]; } bw.write(sum + "\n"); } } }