QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#88984#4062. 军队james1BadCreeper15 325ms4720kbC++141.4kb2023-03-18 08:58:322023-03-18 08:58:35

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-18 08:58:35]
  • 评测
  • 测评结果:15
  • 用时:325ms
  • 内存:4720kb
  • [2023-03-18 08:58:32]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long i64; 
const int BLOCK_SIZE = 1; 

int n, q, C, LL, RR; 
int a[250005], c[250005];
int L[505], R[505], cnt[250005]; 
i64 ans[250005]; 
struct Query {
    int op, l, r, x, y;
} Q[250005]; 

int main(void) {
    scanf("%d%d%d", &n, &q, &C); int t = (n - 1) / BLOCK_SIZE + 1; 
    for (int i = 1; i <= t; ++i) L[i] = R[i - 1] + 1, R[i] = i * BLOCK_SIZE; R[t] = n; 
    for (int i = 1; i <= n; ++i) scanf("%d", a + i); 
    for (int i = 1; i <= n; ++i) scanf("%d", c + i); 
    for (int i = 1; i <= q; ++i) {
        scanf("%d%d%d", &Q[i].op, &Q[i].l, &Q[i].r); 
        if (Q[i].op != 3) scanf("%d%d", &Q[i].x, &Q[i].y); 
    }
    for (int k = 1; k <= t; ++k) {
        LL = L[k], RR = R[k]; i64 res = 0;
        memset(cnt, 0, sizeof cnt); 
        for (int i = LL; i <= RR; ++i) ++cnt[c[i]], res += a[i]; 
        for (int i = 1; i <= q; ++i) {
            int op = Q[i].op, l = Q[i].l, r = Q[i].r, x = Q[i].x, y = Q[i].y;
            if (r < LL || l > RR) continue; 
            if (l <= LL && RR <= r) {
                if (op == 1) cnt[y] += cnt[x], cnt[x] = 0; 
                else if (op == 2) res += 1ll * cnt[x] * y; 
                else ans[i] += res; 
            } else {

            }
        }
    }
    for (int i = 1; i <= q; ++i) if (Q[i].op == 3) printf("%lld\n", ans[i]); 
    return 0; 
}

详细

Test #1:

score: 5
Accepted
time: 2ms
memory: 4548kb

input:

20 20 20
30243234 8075384 84797560 57803992 42319867 50261707 15353170 87049722 52811301 29102071 30384516 10767047 91603720 58528416 15628343 44318195 29714732 36726699 52647799 81762999
20 9 17 6 19 17 16 9 9 16 9 16 20 7 7 6 9 16 20 17
1 7 11 15 8
2 12 18 20 79118894
2 10 10 17 20830614
2 5 13 16...

output:

146267200
355638999
150385566
1049277575
1322069997

result:

ok 5 lines

Test #2:

score: 5
Accepted
time: 2ms
memory: 4508kb

input:

50 50 50
47705292 79259033 79303307 38844616 66412531 43420151 3364357 14597117 99004891 68901351 32135604 39554351 34639440 5387566 19433342 8914638 26472946 66711427 5636444 46153851 87137205 45506835 43469019 2374029 29476960 27618304 3604894 59237007 67952398 37510365 29024217 22096832 59227823 ...

output:

1586177684
1415635369
1165188063
3296140209
3438314155
3940744940
3078084878
2414792814
3001063843
3293036492
4023551530
1613339946
4437973012
3758773712
4839676430

result:

ok 15 lines

Test #3:

score: 5
Accepted
time: 10ms
memory: 4500kb

input:

300 300 300
29243820 83772064 39738037 44878087 31623526 23123134 97305631 33867225 7714687 2676701 30321688 34832789 23015521 12138789 74684400 18275423 76346088 86035029 28062383 69725742 8835044 36317245 9034384 78372175 30264218 32833347 74592384 85439456 9739844 66193122 73529763 87821398 80473...

output:

10118808399
2437328749
6894566899
2382531372
10464596442
8679691771
5910918799
2070123918
4025677477
14258513547
7745443874
3011115333
5024377251
9574097996
9771511985
9593945633
15226211206
12369894829
14571163834
13418269546
12404574705
870236152
6929295272
10925135938
3239802087
3620123601
101537...

result:

ok 111 lines

Test #4:

score: 0
Wrong Answer
time: 325ms
memory: 4720kb

input:

5000 5000 5000
26271334 17740608 6429725 18194643 48835514 48736874 75645934 91140616 18374829 76432627 40519421 35670186 41356817 33934613 49204374 60525054 70544459 92654784 37541847 46656829 1794774 57126165 9249076 63842067 66676926 68366827 79346934 81117986 55171878 1849933 98009783 86222973 8...

output:

77763497795127
19826622534467
8573610348048
62596040230421
145969046338668
50591516454690
4694722432657
123844412682323
74057861663169
68209177304123
4404664202056
124662666139073
3539384366979
127326316221120
52208981608504
73337341317813
1433642366
84250641554330
14029029363173
149031358054991
174...

result:

wrong answer 1st lines differ - expected: '191906686362', found: '77763497795127'

Test #5:

score: 0
Time Limit Exceeded

input:

100000 100000 10
87634691 9238657 78446718 46909652 19480456 92746571 71134242 35370645 88391946 96011588 10281496 38515411 13269227 95849707 75639492 12043745 90981041 93719171 28852973 83236884 67074438 56437908 73606720 2264644 15796665 47645544 73017549 17796174 48048699 38331023 79004296 113483...

output:


result:


Test #6:

score: 0
Time Limit Exceeded

input:

150000 150000 10
45699249 74527354 69158258 66810715 36123128 20997399 18809641 59871912 96656349 80147667 7540841 85964516 30759033 83169693 76371491 74234731 50443576 86328539 34204892 17289803 76716632 96525028 18959662 38159303 67108461 43065478 79616583 68829397 54491360 20760704 37585000 13987...

output:


result:


Test #7:

score: 0
Time Limit Exceeded

input:

200000 200000 10
90783632 43461822 44741311 37815039 58121601 21011778 83299478 20257621 19546636 29642908 66420193 12207707 41441773 86786355 78742526 62600685 20847940 97816438 16899567 23797290 51190806 59663700 95431386 47833589 93718987 69960644 94545546 47867510 35120302 77773119 13773547 1880...

output:


result:


Test #8:

score: 0
Time Limit Exceeded

input:

250000 250000 10
2210222 82935278 19232326 14669930 89812300 35248803 33512605 20033126 77398113 2025289 50924947 16057035 39971776 56952249 38814990 13637331 5595007 85744047 17771895 6626014 92748923 86914124 2193211 93573612 45974481 73034388 90751307 58292005 85309542 95106030 30663836 31643473 ...

output:


result:


Test #9:

score: 0
Time Limit Exceeded

input:

150000 150000 150000
99577522 32012715 68102898 98506256 89365247 71251760 36482614 50882065 3330101 22229696 37660026 51953045 75927882 92198075 61877715 90768880 95438740 21226632 6348028 73090230 73617489 21276430 91320531 39542341 24895777 81863227 51583706 15794235 52344710 98399873 78384055 31...

output:


result:


Test #10:

score: 0
Time Limit Exceeded

input:

250000 250000 250000
56852995 78154998 60271318 10513775 75734822 72600566 5964612 89662045 23401119 59823512 53225375 99397044 3913649 58823943 16620194 61943977 7237680 84859682 3441374 3894884 27292424 34061563 68628278 57552770 35728564 1444697 36285025 91145620 75865799 63807285 73381996 478447...

output:


result:


Test #11:

score: 0
Time Limit Exceeded

input:

150000 150000 150000
71802708 5110137 84478065 39272927 39616444 95839554 27563695 97784082 94614207 56950816 77293301 8669519 22508222 1363851 42748670 76957176 32467306 37586030 79121942 91831589 17912397 47122604 8320928 11597344 39111233 33453209 3637393 39717095 20337398 24764029 49752562 61482...

output:


result:


Test #12:

score: 0
Time Limit Exceeded

input:

200000 200000 200000
70794361 87738164 85865207 44870300 69463701 15394658 90165208 77525961 8406227 29152852 54558684 69930905 33705346 5676378 80429758 41189333 35636071 77140314 43205099 44610846 90528315 11145295 77686535 15302504 29303339 66820293 79629672 25248122 38825046 637535 97066905 8225...

output:


result:


Test #13:

score: 0
Time Limit Exceeded

input:

250000 250000 250000
44897725 4685316 80312977 66416370 37045221 53652540 64608893 38736402 94315253 27113025 23724054 83600804 944234 53789915 38578705 56016955 32943062 15741957 20442492 32512985 51216478 91487596 17080118 85030264 26512956 84765684 34899570 55496069 77376318 32442931 67761720 667...

output:


result:


Test #14:

score: 0
Time Limit Exceeded

input:

150000 150000 150000
17900067 78932069 18293989 38405873 94155098 3735350 14962051 80058300 51104407 36859282 78213107 87943521 78061902 12815549 49062192 60270270 38831524 28451023 70262060 45754565 22829045 6898739 79654475 93991932 48499534 96187176 5073893 30012155 47124979 1138755 40182729 3119...

output:


result:


Test #15:

score: 0
Time Limit Exceeded

input:

250000 250000 250000
54027461 319223 99031875 95715925 19269878 9776579 86722408 70778481 46207527 21433896 15972484 48270769 54399383 94090870 40934533 68860522 58931716 50002726 83304991 6498900 38392886 22829136 43422537 57625355 93122677 60990771 7681213 10369168 36288269 76400049 93782396 89050...

output:


result:


Test #16:

score: 0
Time Limit Exceeded

input:

100000 100000 100000
18898905 78786873 62376741 4477798 86371893 33332061 22853839 88697226 8346050 82304677 92659257 38144035 45376852 98616560 70250484 87325787 39947990 52638546 90256867 45437902 16073925 36472208 33963197 63849229 22670771 48369830 26539662 95533595 20956869 75274561 21941302 56...

output:


result:


Test #17:

score: 0
Time Limit Exceeded

input:

150000 150000 150000
89588275 44632728 86932398 36253637 45602569 26277832 73429980 96226120 86788418 32778562 60499661 85034265 71351994 34724593 35634789 83749438 65284095 85895575 94452349 33514960 3687379 83242310 79248481 78700412 47282605 6032614 76254291 44896517 77405497 87006899 93335302 94...

output:


result:


Test #18:

score: 0
Time Limit Exceeded

input:

200000 200000 200000
34177734 63114232 26119387 45933218 72578491 30192428 62814020 63726812 56098996 22585530 79088184 44653118 61283522 72228938 3107103 32127065 65837640 77771769 31178231 98078838 65705853 820439 74419154 32800270 36510445 25594474 99575894 93386063 68899064 95508265 30558267 964...

output:


result:


Test #19:

score: 0
Time Limit Exceeded

input:

250000 250000 250000
24918897 46510289 11362908 40719901 62264984 82269214 866178 31088617 24468878 92482470 22397651 44766395 82312396 27004202 53218396 87268151 77640722 69497678 9228462 59465250 6368996 60740377 64567135 81629158 99173128 58871415 84209799 19835410 7117321 89557434 70296899 12252...

output:


result:


Test #20:

score: 0
Time Limit Exceeded

input:

250000 250000 250000
85120612 9932286 61758975 8816091 79552272 25448018 90337103 42864270 64745010 3965612 20190114 27357072 30057458 74279926 11726860 72053959 71429613 94011053 25350994 38004713 78859443 91088995 91943536 36283906 89222730 79017534 98580756 7338994 49076137 51515254 10348064 8942...

output:


result: