<题解>
2024-11-07 21:00:55
发布于:上海
1阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
long long a[100010];
long long b[100010];
string s[100010];
int main() {
long long n, m;
cin >> n >> m;
b[0] = 0;
for (int i = 1; i <= n; i++) {
cin >> a[i] >> s[i];
b[i] = b[i - 1] + a[i]; // 记录每首歌的结束时间
}
int left = 1, right = n;
while (left < right) {
int mid = (left + right) / 2;
if (b[mid] < m) {
left = mid + 1;
} else {
right = mid;
}
}
cout << s[left] << endl;
return 0;
}
这里空空如也
有帮助,赞一个