QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#859857 | #9730. Elevator II | MVP_Harry | WA | 0ms | 3712kb | C++20 | 1.1kb | 2025-01-18 03:47:53 | 2025-01-18 03:47:55 |
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;
int max_r = 0;
vector<tuple<int, int, int>> up, down;
for (int i = 0; i < n; i++) {
int l, r;
cin >> l >> r;
if (l >= f) {
up.emplace_back(l, r, i);
max_r = max(max_r, r);
}
else {
ans += r - l;
down.emplace_back(l, r, i);
}
}
sort(up.begin(), up.end());
sort(down.begin(), down.end());
if (!up.empty()) {
ans += max_r - f;
}
cout << ans << endl;
for (auto [_, __, x] : up) {
cout << x + 1 << " ";
}
for (auto [_, __, x] : down) {
cout << x + 1 << " ";
}
cout << endl;
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3712kb
input:
2 4 2 3 6 1 3 2 7 5 6 2 5 2 4 6 8
output:
7 3 1 4 2 5 2 1
result:
wrong answer Participant declares the cost to be 7, but the plan actually costs 11 (test case 1)