QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#859852 | #9730. Elevator II | MVP_Harry | WA | 1ms | 3712kb | C++20 | 794b | 2025-01-18 03:19:30 | 2025-01-18 03:19:31 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#ifdef LOCAL
#include <bits/debug.h>
#else
#define dbg(...)
#endif
int main() {
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int T;
cin >> T;
while (T--) {
int n, f;
cin >> n >> f;
ll ans = 0;
vector<pair<int, int>> a(n);
for (int i = 0; i < n; i++) {
int l, r;
cin >> l >> r;
ans += r - l;
a[i] = {l, i};
}
sort(a.begin(), a.end());
ans += max(0, a[0].first - f);
cout << ans << endl;
for (int i = 0; i < n; i++) {
cout << a[i].second + 1 << " \n"[i == n - 1];
}
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3712kb
input:
2 4 2 3 6 1 3 2 7 5 6 2 5 2 4 6 8
output:
11 2 3 1 4 4 1 2
result:
wrong answer Participant declares the cost to be 4, but the plan actually costs 6 (test case 2)