QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#387889#7750. Revenge on My Bossberarchegas#WA 32ms6492kbC++201.5kb2024-04-12 22:58:242024-04-12 22:58:24

Judging History

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

  • [2024-04-12 22:58:24]
  • 评测
  • 测评结果:WA
  • 用时:32ms
  • 内存:6492kb
  • [2024-04-12 22:58:24]
  • 提交

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<ll> a(n), b(n), c(n);
        for (int i = 0; i < n; i++) {
            cin >> a[i] >> b[i] >> c[i];
        }
        vector<int> before, after, equal;
        for (int i = 0; i < n; i++) {
            if (a[i] < b[i]) before.push_back(i);
            else if (a[i] > b[i]) after.push_back(i);
            else equal.push_back(i);
        }
        sort(before.begin(), before.end(), [&] (int i, int j) {
            return max((a[i] + a[j] + b[j]) * c[j], (a[i] + b[i] + b[j]) * c[i]) 
                 < max((a[j] + a[i] + b[i]) * c[i], (a[j] + b[j] + b[i]) * c[j]);
        });
        sort(after.begin(), after.end(), [&] (int i, int j) {
            return max((a[i] + a[j] + b[j]) * c[j], (a[i] + b[i] + b[j]) * c[i]) 
                 < max((a[j] + a[i] + b[i]) * c[i], (a[j] + b[j] + b[i]) * c[j]);
        });
        for (int x : before) cout << x + 1 << ' ';
        for (int x : equal) cout << x + 1 << ' ';
        for (int x : after) cout << x + 1 << ' ';
        cout << '\n';
    }    
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3648kb

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 5 9 7 1 6 

result:

ok correct

Test #2:

score: 0
Accepted
time: 31ms
memory: 6116kb

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:

70717 6151 48237 28851 35679 19561 94252 73342 13089 34865 69194 82763 50242 22597 3745 24913 97923 53671 77581 47428 82224 93567 61401 50007 4886 28731 54152 91278 99937 6691 26840 6048 46204 66044 60735 44469 20513 45842 18701 46818 27203 9261 50507 8020 72391 54368 86201 18839 64763 61758 40939 3...

result:

ok correct

Test #3:

score: 0
Accepted
time: 23ms
memory: 6136kb

input:

1
99999
30245 831673 1
495617 185056 1
53028 422589 1
503558 778900 1
636981 480008 1
966864 78785 1
644954 303138 1
153080 225499 1
876411 832264 1
758904 549009 1
945000 441995 1
83780 789901 1
883282 832556 1
300776 548075 1
806599 108342 1
354979 831549 1
152110 819163 1
613891 812479 1
856259 6...

output:

42779 26176 16432 93736 36110 21022 69840 33300 88899 48735 24934 97468 58044 16598 54398 41611 25297 90410 54385 38513 14754 7374 40518 45724 3741 95478 36354 5270 92123 87433 5901 57489 42968 40570 60847 61715 65894 68944 27887 3727 38578 14748 15072 79314 41234 42830 79639 35429 60443 63782 12370...

result:

ok correct

Test #4:

score: 0
Accepted
time: 31ms
memory: 6332kb

input:

1
100000
361850 684411 2
188930 167748 2
676274 449963 1
970095 784305 1
412379 854673 1
208323 612179 1
296548 633970 1
560983 633064 2
848966 248363 2
741057 340814 1
393854 435721 2
302707 834494 1
229770 235051 2
875992 747523 2
314215 448795 1
531181 809914 2
786505 95721 1
86557 773136 1
44527...

output:

16321 7131 35939 39108 40409 52183 70501 74664 56736 85313 78033 67062 11374 28893 29910 76382 77675 16590 14329 99654 33902 81051 93812 47118 54934 27805 77685 57504 62353 47016 36321 65709 30222 17782 92966 93722 32969 69339 20699 31143 29231 20833 32593 17020 77014 2193 20753 96742 11108 16406 56...

result:

ok correct

Test #5:

score: 0
Accepted
time: 31ms
memory: 6280kb

input:

1
99999
810798 413222 2
974394 310117 1
987184 606577 2
30598 6635 1
607304 306441 1
438614 583404 1
932894 375890 1
994760 333009 2
937928 950984 2
58774 6426 1
287291 728073 1
421484 592009 1
470520 62631 1
918891 764176 2
997492 642796 1
679223 178361 2
865224 571822 2
112711 192469 1
165146 9387...

output:

38004 71563 34947 26525 22330 44909 47503 52297 78657 28797 29991 22680 7929 68438 15865 70932 27655 90081 30923 61265 20749 31006 35033 64820 20963 86257 21420 27746 3451 43480 36392 44360 16524 76128 8052 60705 72335 52826 82386 88960 8813 60213 12369 84977 96785 82723 23228 1372 34613 67012 54683...

result:

ok correct

Test #6:

score: -100
Wrong Answer
time: 32ms
memory: 6492kb

input:

1
100000
142404 976360 1
924602 517001 3
610429 601247 2
529839 44745 3
606894 456914 2
488586 84093 1
360297 674019 1
435366 740573 3
943187 591275 3
8223 87831 2
703441 689095 1
673115 893499 3
817008 689318 2
237211 187815 1
472404 15953 2
822721 932534 2
275427 591484 3
393890 928933 1
11058 141...

output:

51206 37611 59015 50700 80703 52328 53240 43032 8346 8263 41296 64851 47024 78344 80432 99788 79216 80112 84718 81292 91031 58261 72331 98859 85353 71212 34320 28981 4231 54595 26732 77344 6558 79986 1230 64802 4053 35487 35001 47208 53390 6142 58146 9701 11407 53054 48744 52885 2922 93682 94826 636...

result:

wrong answer Wrong Answer on Case#1