| 14244 | 2025-01-10 10:26:48 | feheristvan | Zenehallgatás | cpp17 | Forditási hiba |
#include <iostream>
#include <vector>
using namespace std;
int main()
{
ios :: sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, k, x, t = 0;
cin >> n >> k;
vector <int> v;
v.resize(n);
for(int i = 0; i < n; i ++){
cin >> x;
t = t + x;
v[i] = t;
}
int h = v[n - 1];
for(int i = 0; i < k; i ++){
cin >> x;
x = x % h;
cout << upper_bound(v.begin(), v.end(), x) - v.begin() + 1 << " ";
}
return 0;
}
open /var/local/lib/isolate/406/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:24:17: error: 'upper_bound' was not declared in this scope
24 | cout << upper_bound(v.begin(), v.end(), x) - v.begin() + 1 << " ";
| ^~~~~~~~~~~