QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#664006#8790. First BilliondaoqiTL 1294ms3840kbC++20982b2024-10-21 18:55:162024-10-21 18:55:17

Judging History

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

  • [2024-10-21 18:55:17]
  • 评测
  • 测评结果:TL
  • 用时:1294ms
  • 内存:3840kb
  • [2024-10-21 18:55:16]
  • 提交

answer

#include<bits/stdc++.h>

using i64 = long long;
using l64 = long double;

std::mt19937_64 rng(std::chrono::system_clock::now().time_since_epoch().count());
constexpr int S = 1e9;

void DAOQI() {
    int n;
    std::cin >> n;
    std::vector<i64> a(n + 1), p(n + 1);
    for (int i = 1; i <= n; i++) {
        std::cin >> a[i];
        p[i] = i;
    }

    for (int i = 1; i <= 10000000; i++) {
        i64 sum = 0;
        for (int l = 1, r = 1; r <= n; r++) {
            sum += a[p[r]];
            while (sum > S) sum -= a[p[l++]];
            if (sum == S) {
                std::cout << r - l + 1 << " ";
                for (int k = l; k <= r; k++) std::cout << p[k] << " ";
                return;
            }
        }
        shuffle(p.begin() + 1, p.end(), rng);
    }
}

signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int T = 1;
    //std::cin >> T;
    while (T--) DAOQI();
    return 0;
}

詳細信息

Test #1:

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

input:

10
386413329 88494216 245947398 316438989 192751270 204627269 65749456 3938400 150458676 345180997

output:

5 5 7 6 9 1 

result:

ok OK (n = 10)

Test #2:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

10
119486233 299942886 169540407 349937991 597883752 32230162 140514533 57341098 12602102 220520836

output:

5 4 3 7 1 10 

result:

ok OK (n = 10)

Test #3:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

14
384615281 84612238 83310504 54746763 142296081 56775470 128760350 343006424 177232390 214368720 67220468 21895072 16352717 224807522

output:

7 10 7 12 1 6 9 13 

result:

ok OK (n = 14)

Test #4:

score: 0
Accepted
time: 0ms
memory: 3608kb

input:

14
270208635 14270307 89661499 113578022 47687195 101043954 38775146 208193324 650676076 351701957 3427619 59535626 24230888 27009752

output:

7 13 11 5 14 7 8 9 

result:

ok OK (n = 14)

Test #5:

score: 0
Accepted
time: 4ms
memory: 3840kb

input:

20
61638928 106712373 5946815 178135484 4937573 111395400 15504655 67139983 101814514 312223647 130341028 43244171 37671364 54108486 337181317 37924824 153793862 70383750 102917244 66984582

output:

10 6 2 17 3 20 1 19 15 7 16 

result:

ok OK (n = 20)

Test #6:

score: 0
Accepted
time: 1ms
memory: 3824kb

input:

20
67858098 61231428 99398662 1883806 82465954 303619377 87516412 154956240 94872199 76508350 13276828 136541811 203282099 99160366 127539385 13364660 141176136 39751629 67888657 127707903

output:

10 10 20 7 18 16 2 6 9 19 15 

result:

ok OK (n = 20)

Test #7:

score: 0
Accepted
time: 4ms
memory: 3588kb

input:

24
17125795 281143405 10375259 196293002 158174864 34520650 52919232 87393970 99085271 62281508 67168428 55174991 54533464 51393059 89276370 41441658 72793517 30466999 73758332 97064918 111541434 142047546 12934221 101092107

output:

12 3 15 23 10 20 13 19 18 4 22 17 5 

result:

ok OK (n = 24)

Test #8:

score: 0
Accepted
time: 25ms
memory: 3664kb

input:

24
70224368 148769600 36654748 23404220 15009825 57449487 46896672 6065662 10377031 133719710 23220853 184445684 8462667 88501546 155244839 229323557 140109402 52520271 78995771 75721556 87987586 118427778 107013825 101453342

output:

12 16 13 9 6 22 8 18 24 4 15 14 2 

result:

ok OK (n = 24)

Test #9:

score: 0
Accepted
time: 110ms
memory: 3612kb

input:

28
122321206 60841271 22767116 183943582 6247754 32767541 19129802 21313874 144503909 59360441 12259051 19044256 50267333 25766572 133411289 32253746 102412217 46186594 55413161 39907615 52325783 86862071 185310732 138228874 22000146 149813853 98156445 77183766

output:

14 12 17 6 8 18 2 16 1 11 5 4 26 28 15 

result:

ok OK (n = 28)

Test #10:

score: 0
Accepted
time: 161ms
memory: 3520kb

input:

28
213829745 40823140 14876795 22548901 35958464 159026037 106482651 52655603 76733934 102794554 100713772 80174862 125840182 3619651 74158077 27699586 14743901 68385227 55117143 39623241 67325444 95072408 46052588 46086093 11650160 66077724 149558313 102371804

output:

14 14 15 24 8 7 23 18 9 28 26 1 4 12 2 

result:

ok OK (n = 28)

Test #11:

score: 0
Accepted
time: 171ms
memory: 3588kb

input:

30
38319400 42378812 172927254 71697590 118171420 5615707 8117586 107362865 18142211 89646810 51847201 37450061 138487251 116358215 15432103 13621837 15084921 15012145 42848714 71166566 37074067 11354748 10702902 244865332 41244161 102695984 217681174 21564320 89607508 33521135

output:

16 18 14 24 15 10 8 3 22 16 1 17 28 11 30 23 2 

result:

ok OK (n = 30)

Test #12:

score: 0
Accepted
time: 87ms
memory: 3660kb

input:

30
239221492 41835739 80260950 47743386 50052259 31410042 1676838 63813733 47622772 150506632 188312503 190432229 6783832 111319580 122183547 37258127 12116231 29322396 58095114 47089744 9262724 204673438 11840273 64585542 11797425 4134848 56164171 30717831 46921664 2844938

output:

15 7 20 25 15 28 14 27 16 5 12 4 8 11 18 17 

result:

ok OK (n = 30)

Test #13:

score: 0
Accepted
time: 1245ms
memory: 3612kb

input:

30
52710609 39033241 15723499 29898108 62692739 138885388 137151511 90118964 15492963 61261380 35071118 195401367 64471367 39372151 70235925 114596786 27917908 29285928 11044525 11941155 12716377 1533910 24799365 265236184 104128755 17709404 4856890 204911218 17131655 104669610

output:

15 9 15 10 3 7 2 17 12 22 20 14 28 1 16 21 

result:

ok OK (n = 30)

Test #14:

score: 0
Accepted
time: 358ms
memory: 3540kb

input:

30
71176974 17279544 55258168 53966156 72625891 26990484 32947301 24238341 23523054 74032236 11115471 37748780 197790571 37391026 97632202 141185045 78244645 55562875 112526424 172476633 23788890 38112613 43056490 59434820 126859036 3192138 33541518 45692823 37948025 194661826

output:

13 16 30 26 20 24 18 5 10 21 15 8 22 23 

result:

ok OK (n = 30)

Test #15:

score: 0
Accepted
time: 286ms
memory: 3656kb

input:

30
14207343 153611578 16683105 27989436 25086738 33243492 111638179 47972430 19637539 35808627 12134813 60480737 68270077 122259678 37288938 86244354 36408417 58808264 33320672 9412909 176141849 93548029 55980295 128091293 13973554 27108753 77442637 246155003 18397254 152654007

output:

15 14 25 10 26 11 5 1 30 4 13 2 21 29 18 22 

result:

ok OK (n = 30)

Test #16:

score: 0
Accepted
time: 1294ms
memory: 3812kb

input:

34
56158267 5346691 37606439 26760105 123601340 44674017 43239382 23064728 175228414 72881379 25027579 73516264 13748174 69400907 47140260 105416679 45175827 129325284 14737537 147069844 84833847 91264478 15805185 5872801 60910166 8127595 87459162 153141045 24930343 27343635 11563194 56545951 773088...

output:

17 13 4 5 30 29 25 9 32 34 23 17 2 18 8 1 15 28 

result:

ok OK (n = 34)

Test #17:

score: 0
Accepted
time: 912ms
memory: 3748kb

input:

34
6553507 21827844 163114470 285889880 111444346 91096849 9875033 155790401 48814749 32707381 4390111 3512692 227551194 24852373 35077911 52304487 14043961 21718427 153749785 10890230 81276988 24039619 19484842 19224458 60528342 80892446 43482284 3024810 18734584 44556796 18825186 16762113 91529698...

output:

18 7 27 18 30 33 15 8 5 19 23 21 24 10 25 11 16 17 9 

result:

ok OK (n = 34)

Test #18:

score: 0
Accepted
time: 398ms
memory: 3612kb

input:

34
6510953 149563269 90208590 17087264 54154081 48557639 30119336 148147082 30167332 41026594 23352774 7503341 127871531 56098411 30309985 90903962 20775544 12444200 23139566 173775423 39698044 23256886 32599474 19795212 62981178 43614848 71114165 138887136 8874281 1542445 96191893 14339496 11492279...

output:

16 21 8 23 26 7 11 27 32 4 12 33 3 24 20 22 34 

result:

ok OK (n = 34)

Test #19:

score: 0
Accepted
time: 418ms
memory: 3812kb

input:

34
76165834 52107905 64590881 31631692 6704569 151480738 146750957 43792305 11263200 3762351 55603212 9648993 8323006 63561211 39768967 5565808 18484315 47155971 95389177 39661235 158388679 115049517 90536356 16230 36970573 69805600 69394080 162875090 33332306 141161983 59599679 47506416 36779765 71...

output:

20 8 24 6 31 14 22 33 13 26 12 5 3 15 25 30 1 9 34 17 20 

result:

ok OK (n = 34)

Test #20:

score: 0
Accepted
time: 339ms
memory: 3608kb

input:

34
54830390 113752786 1256295 65643133 17997234 93531549 17982160 52907635 60890541 46120250 33991135 36315875 125481200 21717043 2931945 204316378 34997684 89844853 71646618 44706963 444743 16090084 221143946 50917758 48030413 93143102 2161608 69130708 43539172 92362195 26368947 33556321 68574624 4...

output:

14 29 27 22 20 13 17 31 8 25 28 7 23 16 26 

result:

ok OK (n = 34)

Test #21:

score: 0
Accepted
time: 1185ms
memory: 3812kb

input:

38
61295704 120959759 13190535 82400573 19952027 65933932 6386901 31702075 26739290 8114929 40114285 36513729 14021915 36412926 103842230 23073744 64285890 7726874 7069826 11026974 112061519 86593033 24948152 31660315 58256958 56241422 21694304 2454321 4008850 145718408 71162340 18472714 32541051 17...

output:

16 3 8 38 16 2 34 32 1 5 26 31 7 10 21 29 37 

result:

ok OK (n = 38)

Test #22:

score: -100
Time Limit Exceeded

input:

38
6041181 60606547 25009256 67510442 13154279 42254607 13913303 70468898 83661964 9693776 14673029 65391499 20900136 70775729 232451283 120308939 8000114 57176181 37323456 8856486 83542977 169853088 65998342 73938927 89977321 33127725 18524012 98889224 37672769 64174135 84811684 35339006 11678853 4...

output:


result: