QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#255731#7750. Revenge on My Bossucup-team173#WA 36ms5188kbC++171.1kb2023-11-18 16:54:532023-11-18 16:54:54

Judging History

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

  • [2023-11-18 16:54:54]
  • 评测
  • 测评结果:WA
  • 用时:36ms
  • 内存:5188kb
  • [2023-11-18 16:54:53]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define pb push_back
#define Mp make_pair
#define SZ(x) (int((x).size()))

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

void solve() {
    int n;
    cin >> n;

    vector<array<int, 4>> ve(n);
    for(int i = 0; i < n; i++) {
        cin >> ve[i][0] >> ve[i][1] >> ve[i][2];
        ve[i][3] = i;
    }
    sort(ve.begin(), ve.end(), [&](array<int, 4> &a, array<int, 4> &b) {
        if(a[2] != b[2]) return a[2] > b[2];
        int fla = a[0] < a[1], flb = b[0] < b[1];
        if(fla != flb) return fla > flb;
        if(fla) {
            return (a[1] - a[0]) < (b[1] - b[0]);
        } else {
            return (a[0] - a[1]) < (b[0] - b[1]);
        }
    });
    
    deque<int> q;
    for(auto [a, b, c, id] : ve) {
        if(a < b) q.push_front(id);
        else q.push_back(id);
    }
    for(auto x : q) cout << x + 1 << " ";
    cout << "\n";
}
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    int t = 1;
    cin >> t;
    while(t--) solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3432kb

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

result:

ok correct

Test #2:

score: -100
Wrong Answer
time: 36ms
memory: 5188kb

input:

1
100000
581297 102863 1
742857 42686 1
676710 233271 1
443055 491162 1
442056 28240 1
769277 331752 1
8608 369730 1
495112 525554 1
787449 938154 1
441186 850694 1
84267 925450 1
740811 32385 1
834021 37680 1
257878 564126 1
90618 914340 1
239641 463103 1
40687 343062 1
587737 458554 1
103684 48666...

output:

77582 77581 82112 72163 18220 43645 30468 80107 54173 17444 14872 8630 50133 26305 35 70096 40298 10072 56385 75312 79444 19284 81622 95793 96892 82320 8443 11434 56765 72103 89089 86041 48305 32033 88191 83243 9383 66880 81866 31386 23642 79775 66240 99937 38682 18931 39524 48449 36540 202 11001 62...

result:

wrong answer Wrong Answer on Case#1