QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#71616#1697. Balance BeamHe_Ren27.272727 28ms5960kbC++231.2kb2023-01-11 16:28:372023-01-11 16:28:40

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-11 16:28:40]
  • 评测
  • 测评结果:27.272727
  • 用时:28ms
  • 内存:5960kb
  • [2023-01-11 16:28:37]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ldb;
typedef pair<int, int> pii;
const int MAXN = 1e5 + 5;

struct Vector {
    ll x, y;
    Vector(void) {}
    Vector(ll _x, ll _y): x(_x), y(_y) {}
};
Vector operator - (const Vector &p, const Vector &q) {
    return Vector(p.x - q.x, p.y - q.y);
}
ll cross(const Vector &p, const Vector &q) {
    return p.x * q.y - p.y * q.x;
}

int a[MAXN];

int main(void) {
    int n;
    scanf("%d", &n);

    for (int i = 1; i <= n; ++i)
        scanf("%d", &a[i]);

    static Vector h[MAXN];
    int tp = 0;
    h[++tp] = Vector(0, 0);

    for (int i = 1; i <= n + 1; ++i) {
        Vector cur(i, a[i]);

        while (tp >= 2 && cross(cur - h[tp], cur - h[tp - 1]) <= 0)
            --tp;

        h[++tp] = cur;
    }

    static ll ans[MAXN];

    for (int i = 1; i < tp; ++i) {
        ldb delta = ldb(h[i + 1].y - h[i].y) / (h[i + 1].x - h[i].x);

        for (int j = h[i].x; j < h[i + 1].x; ++j)
            ans[j] = (h[i].y + delta * (j - h[i].x)) * 1e5;
    }

    for (int i = 1; i <= n; ++i)
        printf("%lld\n", ans[i]);

    return 0;
}

詳細信息

Test #1:

score: 9.09091
Accepted
time: 2ms
memory: 3808kb

input:

2
1
3

output:

150000
300000

result:

ok 2 lines

Test #2:

score: 0
Wrong Answer
time: 14ms
memory: 5960kb

input:

100000
10550
10166
14944
34729
60262
25398
4608
4103
101193
91415
63390
56440
54875
168733
55861
115845
204889
86170
228991
45049
188746
174299
157006
230942
301295
28758
261824
283112
3483
361548
373598
385647
261775
110588
350711
61727
397275
359292
469989
100405
262091
249753
383032
300999
521216...

output:

1205240000
2410480000
3615720000
4820960000
6026200000
7231433333
8436666666
9641900000
10847133333
12052366666
13257600000
14462833333
15668066666
16873300000
18078500000
19283700000
20488900000
21694000000
22899100000
24104166666
25309233333
26514300000
27719366666
28924433333
30129500000
31334560...

result:

wrong answer 27th lines differ - expected: '32539620000', found: '32539619999'

Test #3:

score: 0
Wrong Answer
time: 28ms
memory: 4820kb

input:

100000
96
69
618
440
1643
2449
2117
73
470
4080
1853
1106
2589
4981
6118
4134
4702
3077
2592
8155
8562
6144
9375
5120
3709
18
11000
11405
8836
12214
11637
5468
10706
11093
14235
9866
15042
12766
15586
14034
11827
17058
10880
17863
15006
11739
15698
307
6830
17584
2846
21082
14912
21886
6967
7840
110...

output:

40816666
81633333
122450000
163266666
204083333
244900000
285675000
326450000
367225000
408000000
448760000
489520000
530279999
571040000
611800000
652540000
693280000
734020000
774760000
815500000
856200000
896850000
937500000
978125000
1018750000
1059375000
1100000000
1140500000
1180950000
1221400...

result:

wrong answer 13th lines differ - expected: '530280000', found: '530279999'

Test #4:

score: 9.09091
Accepted
time: 2ms
memory: 3772kb

input:

200
86857
23812
79982
44721
28718
48332
86220
19866
23758
48884
24781
92876
58394
30676
50939
1246
77228
69833
9109
556
16565
75867
28884
59093
85906
14369
45990
60314
18861
30445
70991
5717
54256
50973
66796
99332
99297
53016
19197
39420
1899
60337
48662
60285
91012
15966
61531
68233
85791
87005
68...

output:

8685700000
8740418181
8795136363
8849854545
8904572727
8959290909
9014009090
9068727272
9123445454
9178163636
9232881818
9287600000
9314500000
9341400000
9368300000
9395200000
9422100000
9449000000
9475900000
9502800000
9529700000
9556600000
9583500000
9610400000
9637300000
9664200000
9691100000
971...

result:

ok 200 lines

Test #5:

score: 9.09091
Accepted
time: 1ms
memory: 3668kb

input:

5000
72083
34770
50448
76733
68071
44356
12800
25882
23411
61847
16071
72060
55263
60945
34424
53020
42724
63542
67935
83270
33043
38718
83427
34388
62968
70173
21833
51799
79193
53222
42211
67634
87991
9024
60726
72427
53373
89884
14667
93149
51730
30731
81567
6986
91668
15990
76371
50757
95891
443...

output:

7208300000
7363300000
7518300000
7673300000
7719534693
7765769387
7812004081
7858238775
7904473469
7950708163
7996942857
8043177551
8089412244
8135646938
8181881632
8228116326
8274351020
8320585714
8366820408
8413055102
8459289795
8505524489
8551759183
8597993877
8644228571
8690463265
8736697959
878...

result:

ok 5000 lines

Test #6:

score: 0
Wrong Answer
time: 26ms
memory: 4792kb

input:

100000
42613
39648
57462
23706
42581
34382
11589
50774
50931
75743
25387
27284
87003
6993
79687
62698
48230
55958
56398
32739
15357
23709
43837
63327
75293
19706
99184
8645
97561
7812
79584
40173
63825
53405
63879
6405
87786
91833
73537
55075
83934
98924
98725
70936
22282
78411
49993
86870
34369
639...

output:

4261300000
5003750000
5746200000
6041610000
6337020000
6632429999
6927840000
7223250000
7518660000
7814070000
8109479999
8404890000
8700300000
8787307142
8874314285
8961321428
9048328571
9135335714
9222342857
9309350000
9396357142
9483364285
9570371428
9657378571
9744385714
9831392857
9918400000
991...

result:

wrong answer 6th lines differ - expected: '6632430000', found: '6632429999'

Test #7:

score: 0
Wrong Answer
time: 21ms
memory: 4972kb

input:

100000
126
176
450
531
845
960
230
2029
2013
2441
393
898
2963
396
737
1576
4686
4531
2548
2752
2937
3500
5263
3681
4832
139
6997
7064
6827
1909
996
2040
10621
7628
9694
2289
5908
5695
1652
12862
2098
5532
10892
8000
10477
14202
1137
306
4843
14167
4747
270
6973
12124
1864
8646
5054
11755
14676
8514...

output:

33163218
66326436
99489655
132652873
165816091
198979310
232142528
265305747
298468965
331632183
364795402
397958620
431121839
464285057
497448275
530611494
563774712
596937931
630101149
663264367
696427586
729590804
762754022
795917241
829080459
862243678
895406896
928570114
961733333
994896551
102...

result:

wrong answer 1834th lines differ - expected: '60811040000', found: '60811039999'

Test #8:

score: 0
Wrong Answer
time: 18ms
memory: 4828kb

input:

100000
76
320
230
1049
962
705
1290
1673
1370
572
873
3333
1530
3522
2985
4212
937
3528
3357
3933
6327
2801
5408
2537
1003
391
6600
6753
1950
4710
2494
3941
3426
6421
7121
7049
4959
8943
4434
1871
6061
528
7278
1237
6495
13185
9374
273
10115
9355
11733
4274
7866
16015
7578
12801
12699
9034
6295
1159...

output:

30810599
61621198
92431797
123242396
154052995
184863594
215674193
246484792
277295391
308105990
338916589
369727188
400537788
431348387
462158986
492969585
523780184
554590783
585401382
616211981
647022580
677833179
708643778
739454377
770264976
801075576
831886175
862696774
893507373
924317972
955...

result:

wrong answer 991st lines differ - expected: '30454820000', found: '30454819999'

Test #9:

score: 0
Wrong Answer
time: 25ms
memory: 5900kb

input:

100000
285
1191
4032
4253
2028
6342
6259
129
12406
10505
1861
7574
7081
13668
20727
13386
18752
17757
26939
12650
7879
6210
28257
21004
28122
36862
103
26569
7459
40624
12927
12953
26705
18007
37564
38149
13381
9977
51047
50996
38898
13414
59125
36150
15396
49423
20199
1043
5212
62121
63394
33190
56...

output:

141784210
283568421
425352631
567136842
708921052
850705263
992489473
1134273684
1276057894
1417842105
1559626315
1701410526
1843194736
1984978947
2126763157
2268547368
2410331578
2552115789
2693900000
2835657142
2977414285
3119171428
3260928571
3402685714
3544442857
3686200000
3827956410
3969712820...

result:

wrong answer 449th lines differ - expected: '63629740000', found: '63629739999'

Test #10:

score: 0
Wrong Answer
time: 15ms
memory: 4828kb

input:

100000
3700
2515
19050
13718
42454
50943
15036
21588
17968
63237
68840
49149
110365
44575
118371
118979
138079
110883
128494
99640
146984
60252
166941
100574
30480
154004
219764
151278
163270
4936
62463
187683
57978
207856
276102
128289
122059
109461
331073
329012
312878
348679
289155
120329
119050
...

output:

849080000
1698160000
2547239999
3396320000
4245400000
5094300000
5943185714
6792071428
7640957142
8489842857
9338728571
10187614285
11036500000
11885376923
12734253846
13583130769
14432007692
15280884615
16129761538
16978638461
17827515384
18676392307
19525269230
20374146153
21223023076
22071900000
...

result:

wrong answer 3rd lines differ - expected: '2547240000', found: '2547239999'

Test #11:

score: 0
Wrong Answer
time: 17ms
memory: 4896kb

input:

100000
234
72
826
1282
2883
6351
9173
4949
12623
4562
8352
9630
15317
17653
5224
17730
22248
11805
14165
9730
21425
935
21759
33803
31229
1903
13560
42166
1775
8762
8291
15655
15439
11824
27529
54213
21905
3239
31119
20433
22022
37367
42523
4878
40568
49055
61970
53282
17789
39217
76800
6074
7198
73...

output:

150592857
301185714
451778571
602371428
752964285
903557142
1054150000
1204742857
1355335714
1505928571
1656521428
1807114285
1957707142
2108300000
2258892857
2409485714
2560078571
2710671428
2861264285
3011857142
3162450000
3313042857
3463635714
3614228571
3764821428
3915414285
4066007142
421660000...

result:

wrong answer 47th lines differ - expected: '7077680000', found: '7077679999'