Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long ll;typedef long double lf;typedef double fl;typedef string str;
- typedef vector<int> vi;typedef vector<vector<int>> vvi;typedef vector<fl> vf;typedef vector<ll> vl;
- typedef vector<lf> vlf;typedef vector<char> vc;typedef vector<str> vs;typedef pair<int,int> ii;
- # define f(i,a,b,c) for(ll i=a;i<b;i+=c)
- # define fd(i,a,b,c) for(ll i=a;i>=b;i-=c)
- ll soma[200000], au, n, q, x, y;
- int main(){
- ios::sync_with_stdio(0);cin.tie(0);cout.precision(2);cout.setf(ios::fixed);
- cin>>n>>q;
- soma[0] = 0;
- f(i,1,n+1,1){
- cin>>au;
- soma[i] = soma[i-1]+au;
- }
- f(i,0,q,1){
- cin>>x>>y;
- cout<<soma[y]-soma[x-1]<<'\n';
- }
- }
Add Comment
Please, Sign In to add comment