QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#859852#9730. Elevator IIMVP_HarryWA 1ms3712kbC++20794b2025-01-18 03:19:302025-01-18 03:19:31

Judging History

你现在查看的是最新测评结果

  • [2025-01-18 03:19:31]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3712kb
  • [2025-01-18 03:19:30]
  • 提交

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)