█████████ ████ ███░░░░░███ ░░███ ███ ░░░ ██████ ███████ ██████ ██████ ░███ ███░░███ ███░░███ ███░░███ ███░░███ ░███ ░███ ░███░███ ░███ ░███████ ░███ ░███ ░░███ ███░███ ░███░███ ░███ ░███░░░ ░███ ░███ ░░█████████ ░░██████ ░░████████░░██████ ░░██████ ░░░░░░░░░ ░░░░░░ ░░░░░░░░ ░░░░░░ ░░░░░░

Envío 3888

Problema 0x25 - Suma de un subarreglo grande

  • Autor: Jhon_z09
  • Fecha: 2021-04-20 19:59:30 UTC (Hace casi 3 años)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#2
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#3
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#4
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#5
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#6
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#7
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#8
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#9
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#10
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#11
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#12
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#13
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
#14
Error de compilación
                      main.c:1:10: fatal error: 'bits/stdc++.h' file not found
#include <bits/stdc++.h>
         ^~~~~~~~~~~~~~~
1 error generated.

                    
Puntos totales: 0 / 100

Código

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
   ios::sync_with_stdio(false);
   cin.tie(0); cout.tie(0);

   int n; cin >> n;
   vector<int> arr(n);
   for(int i = 0; i < n; ++i) cin >> arr[i];

   int c; cin >> c;
   while(c--){
        int p, q, S = 0; cin >> p >> q;
        for(int i=p; i<=q; ++i) S += arr[i];
        cout << S << "\n";
   }
   return 0;
}