Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stack>
- #include <math.h>
- #include <iostream>
- #include <algorithm>
- #include <string.h>
- #include <string>
- #include <set>
- #include <memory.h>
- #include <vector>
- #include <map>
- #include <queue>
- #include <iomanip>
- #include <ctime>
- #include <cassert>
- #define forn(i, n) for (int i = 0; i < (n); i++)
- #define ll long long
- #define mp(a, b) make_pair(a, b)
- using namespace std;
- vector <ll> a;
- map <ll, int> v;
- int main() {
- #ifdef _DEBUG
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- #endif
- int n;
- cin >> n;
- int temp;
- cin >> temp;
- a.push_back(temp);
- v[a.back()] = 1;
- for (int i = 1; i < n; i++) {
- cin >> temp;
- a.push_back(temp + a.back());
- v[a.back()] = i + 1;
- }
- int m;
- cin >> m;
- forn (i, m) {
- int q;
- cin >> q;
- cout << v[*(lower_bound(a.begin(), a.end(), q))] << endl;;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement