Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <bits/stdc++.h>
- //#define FAST_ALLOCATOR_MEMORY 2e8
- //#include "optimization.h"
- using namespace std;
- #define ALL(x) x.begin(), x.end()
- typedef long long ll;
- typedef unsigned long long ull;
- typedef long double ld;
- typedef pair<int,int> pii;
- const int inf = (int)1e9;
- const ll md = (ll)1e9 + 7, inf64 = (ll)1e18;
- int main() {
- iostream::sync_with_stdio(0);
- cin.tie(0), cout.tie(0);
- #ifdef LOCAL
- freopen("C:\\Users\\aytel\\CLionProjects\\common\\input.txt", "r", stdin);
- freopen("C:\\Users\\aytel\\CLionProjects\\common\\output.txt", "w", stdout);
- #endif
- int n, m;
- cin >> n >> m;
- ll sum = 0;
- vector<ll> ends;
- while (n--) {
- ll c, t;
- cin >> c >> t;
- sum += c * t;
- ends.push_back(sum);
- }
- while (m--) {
- ll t;
- cin >> t;
- cout << lower_bound(ends.begin(), ends.end(), t) - ends.begin() + 1 << '\n';
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement