QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#387860#7750. Revenge on My Bossberarchegas#WA 1ms3860kbC++201.2kb2024-04-12 22:06:422024-04-12 22:06:43

Judging History

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

  • [2024-04-12 22:06:43]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3860kb
  • [2024-04-12 22:06:42]
  • 提交

answer

#include <bits/stdc++.h>
 
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
 
mt19937 rng((int) chrono::steady_clock::now().time_since_epoch().count());
    
const int MOD = 1e9 + 7;
const int MAXN = 5e5 + 5;
const ll INF = 2e18;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int> a(n), b(n), c(n);
        ll sum = 0, best = 0, mx = 0;
        for (int i = 0; i < n; i++) {
            cin >> a[i] >> b[i] >> c[i];
            sum += min(a[i], b[i]);
        }
        for (int i = 0; i < n; i++) {
            ll aqui = (sum + max(a[i], b[i])) * c[i];
            if (aqui > mx) {
                mx = aqui;
                best = i;
            }
        }
        vector<int> before, after;
        for (int i = 0; i < n; i++) {
            if (i == best) continue;
            if (a[i] < b[i]) before.push_back(i + 1);
            else after.push_back(i + 1);
        }

        for (int x : before) cout << x << ' ';
        cout << best + 1 << ' ';
        for (int x : after) cout << x << ' ';
        cout << '\n';
    }    
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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 2 1 4 
2 3 4 8 5 1 6 7 9 

result:

wrong answer Wrong Answer on Case#2