momo2345

worm_map

Sep 5th, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.04 KB | None | 0 0
  1.  
  2. // ********* Assalamualaikum****** IN the name of my Almighty****:):)***
  3. #include<bits/stdc++.h>
  4. using namespace std;
  5. #define suni ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
  6. #define endl "\n"
  7. #define f(i,a,b) for(int i=a;i< b;i++)
  8. #define ff(i,a,b) for(int i= a;i>=b;i--)
  9. #define T int t; cin >>t; while(t--)
  10. #define vi  vector<int>
  11. #define vll vector<long long>
  12. #define vs vector<string>
  13. #define vp vector<pair
  14. #define pii pair<int,int>
  15. #define pb push_back
  16. #define mk make_pair
  17. #define b(a) a.begin(),a.end()
  18. #define rb(a) a.rbegin(),a.rend()
  19. #define I  int
  20. #define ll long long
  21. #define st string
  22. #define C char
  23. #define mn int main()
  24. #define fa(u,v) for(auto u:v)
  25. mn
  26. {
  27.     suni;
  28.     ll n;
  29.     cin>>n;
  30.     map<ll,ll>m;
  31.     ll i=1,x=1;
  32.     while(n--){
  33.         ll t;
  34.         cin>>t;
  35.         while(t--){
  36.             m[i]=x;
  37.             i++;
  38.         }
  39.         x++;
  40.     }
  41.     ll p;
  42.     cin>>p;
  43.     while(p--){
  44.         ll t;
  45.         cin>>t;
  46.         cout<<m[t]<<endl;
  47.     }
  48. }
  49. //*******Happy Coding*******???******
  50.  
Add Comment
Please, Sign In to add comment