QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#887043#10001. Big Sieve Gamerotcar07AC ✓15ms5248kbC++23360b2025-02-07 14:25:432025-02-07 14:25:44

Judging History

This is the latest submission verdict.

  • [2025-02-07 14:25:44]
  • Judged
  • Verdict: AC
  • Time: 15ms
  • Memory: 5248kb
  • [2025-02-07 14:25:43]
  • Submitted

answer

#include<bits/stdc++.h>
using namespace std;
constexpr int N=2e5+5;
typedef long long ll;
int n;ll a[N],ans;
int main(){
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    for(int i=1;i<=n;i++){
        for(int j=i+i;j<=n;j+=i) a[j]-=a[i];
        ans+=abs(a[i]);
    }
    cout<<ans<<'\n';
}

详细

Test #1:

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

input:

4
1 1 1 0

output:

2

result:

ok 1 number(s): "2"

Test #2:

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

input:

7
0 1 1 1 0 2 -1

output:

3

result:

ok 1 number(s): "3"

Test #3:

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

input:

1
336089065

output:

336089065

result:

ok 1 number(s): "336089065"

Test #4:

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

input:

2
-702116669 64739924

output:

1468973262

result:

ok 1 number(s): "1468973262"

Test #5:

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

input:

3
797734683 -276245859 -581086167

output:

3250536075

result:

ok 1 number(s): "3250536075"

Test #6:

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

input:

4
2618741 -617231643 -324638576 984709394

output:

2551667479

result:

ok 1 number(s): "2551667479"

Test #7:

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

input:

5
964413007 -958217426 -68190984 -553679538 -664090402

output:

5952688728

result:

ok 1 number(s): "5952688728"

Test #8:

score: 0
Accepted
time: 15ms
memory: 5120kb

input:

200000
736775112 770850510 -998054228 -179649196 -346164921 452590138 -767467425 674023798 447763543 826373232 -597262490 -285233610 -633985010 785724387 -58904597 78954220 -930178484 -121601201 -430307819 772408976 -590739547 -900688146 -925821814 -941963437 897057373 98980120 752333470 660592373 8...

output:

289937018633898

result:

ok 1 number(s): "289937018633898"

Test #9:

score: 0
Accepted
time: 12ms
memory: 5120kb

input:

200000
-380521880 -873715124 -680894341 546956886 340479487 245491029 723583665 -485175362 982349514 794493052 345672598 -220495670 983833005 -422815611 -66612342 -738038849 302722967 -665522092 -707191150 130882122 192303695 -865925077 782715218 -688621044 338186740 72274286 -741964986 -395117637 6...

output:

266978530655485

result:

ok 1 number(s): "266978530655485"

Test #10:

score: 0
Accepted
time: 12ms
memory: 5120kb

input:

200000
797148423 -223313464 -68767160 -431469739 -729786313 281481712 561479549 945560067 -483064517 -647452541 -416425020 -502602527 601651018 -169412694 463736999 150000789 -707465376 -671385897 -689107187 951298184 975346938 -779284506 786219544 -435278651 -272561395 583625539 58703853 549172354 ...

output:

256836833083083

result:

ok 1 number(s): "256836833083083"

Test #11:

score: 0
Accepted
time: 13ms
memory: 5248kb

input:

200000
-320148569 80243400 300270228 347013844 -43141904 612439689 52530637 -213639093 -243445840 -384365426 821477362 -437864587 -75498263 327080015 699119046 -910082072 525436074 -972216996 -671023223 66681539 -536577115 -397676642 494756575 -130058756 -588342236 851886999 26348312 -749627448 -710...

output:

230599385543937

result:

ok 1 number(s): "230599385543937"

Test #12:

score: 0
Accepted
time: 14ms
memory: 5248kb

input:

200000
857521734 730645061 912397409 -926380075 938469798 405340579 -161450981 922129043 -3827164 -416245606 59379744 -668093941 -214590458 580482933 691411301 272924860 -484752268 778829409 757126153 -574845314 3376336 -67946279 446383398 123283638 800909630 -879851542 532049857 -100304751 -6431691...

output:

253005598382544

result:

ok 1 number(s): "253005598382544"

Test #13:

score: 0
Accepted
time: 12ms
memory: 5120kb

input:

200000
866437561 -828674702 882398804 -862364012 817022471 -941385519 828251880 -842957393 802335856 -896989218 980833133 -806514466 948147785 -809530740 945637736 -861271451 925216643 -895463768 929946908 -862434657 932873711 -822008040 863463256 -828331493 834712176 -887572805 950177452 -814441042...

output:

24146288838686

result:

ok 1 number(s): "24146288838686"

Test #14:

score: 0
Accepted
time: 12ms
memory: 5120kb

input:

200000
840389769 -941303401 921729860 -877295514 869323195 -881787614 825520667 -973931932 864820871 -911888442 829428824 -867878473 919010205 -803972294 868842259 -928233350 872118602 -880245596 900237108 -924063493 839732457 -841965125 912865933 -996809694 876079070 -837750141 884312194 -890332087...

output:

22945053806666

result:

ok 1 number(s): "22945053806666"

Test #15:

score: 0
Accepted
time: 12ms
memory: 5248kb

input:

200000
814341977 -843866647 909042220 -987194291 859539772 -822189709 979840875 -999873745 927305885 -916722215 835075937 -824209753 856989496 -955465269 919897185 -995195248 851903691 -822078845 870527308 -923608183 808675348 -851856758 900184464 -860255168 917445964 -944978897 923479663 -914204437...

output:

27549133551314

result:

ok 1 number(s): "27549133551314"

Test #16:

score: 0
Accepted
time: 13ms
memory: 5120kb

input:

200000
893326911 -818579491 948373276 -940041648 911840496 -900507659 967044211 -835881007 884758174 -826588713 850788501 -885573759 900001514 -949906822 843101707 -862157146 831688779 -806860674 935784783 -880204293 915534095 -828865262 844554416 -966649223 968878309 -990123508 962647131 -895128207...

output:

24257788835248

result:

ok 1 number(s): "24257788835248"

Test #17:

score: 0
Accepted
time: 13ms
memory: 5120kb

input:

200000
867279119 -826175463 925620186 -849940424 902057073 -840909754 826397144 -861822820 842210462 -936455211 961468339 -998956461 837980805 -839315650 894156633 -867034899 978590739 -948693924 906074984 -879748983 927425566 -943789621 893957093 -830094697 810245202 -940300844 801814598 -971019252...

output:

24006447714016

result:

ok 1 number(s): "24006447714016"

Test #18:

score: 0
Accepted
time: 13ms
memory: 5120kb

input:

200000
1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000 -1000000000 1000000000 -10000...

output:

3000000000

result:

ok 1 number(s): "3000000000"