QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#670295#7750. Revenge on My Bosslllei#WA 1ms3560kbC++231.0kb2024-10-23 21:13:252024-10-23 21:13:25

Judging History

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

  • [2024-10-23 21:13:25]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3560kb
  • [2024-10-23 21:13:25]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
struct A {
    long long a, b, c;
    int flag;
    int num;
} a[N];
int n;
long long tot = 0;
bool ss(A t1, A t2) {
    if (t1.flag != t2.flag)
        return t1.flag < t2.flag;
    if (t1.flag) {
        return t1.c * (t2.a - t2.b) > t2.c * (t1.a - t1.b);
    } else
        return t1.c * (t2.b - t2.a) < t2.c * (t1.b - t1.a);
}

int main() {
    int T;
    cin >> T;
    while (T--) {
        tot = 0;
        cin >> n;
        for (int i = 1; i <= n; i++) {
            cin >> a[i].a >> a[i].b >> a[i].c;
            if (a[i].a > a[i].b) {
                a[i].flag = 1;
            } else
                a[i].flag = 0;
            a[i].num = i;
            tot += min(a[i].a, a[i].b);
        }
        sort(a + 1, a + n + 1, ss);
        for (int i = 1; i <= n; i++)
            if (i != n)
                cout << a[i].num << ' ';
            else
                cout << a[i].num;
        cout << '\n';
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3560kb

input:

2
4
1 1 4
5 1 5
1 9 1
9 8 1
9
3 1 4
1 5 9
2 6 5
3 5 8
9 7 9
3 2 3
8 4 6
2 6 8
3 2 7

output:

3 1 2 4
3 8 2 4 9 5 6 1 7

result:

wrong answer Wrong Answer on Case#2