QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#223512#1967. StatisticsBUET_Twilight#AC ✓1ms3688kbC++231.1kb2023-10-22 11:53:222023-10-22 11:53:22

Judging History

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

  • [2023-10-22 11:53:22]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3688kb
  • [2023-10-22 11:53:22]
  • 提交

answer

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds;
using namespace std;
#define getbit(n, i) (((n) & (1LL << (i))) != 0) 
#define setbit0(n, i) ((n) & (~(1LL << (i)))) 
#define setbit1(n, i) ((n) | (1LL << (i))) 
#define togglebit(n, i) ((n) ^ (1LL << (i))) 
#define lastone(n) ((n) & (-(n))) 
char gap = 32;
#define ll long long 
#define int long long 
#define lll __int128_t
#define pb push_back
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void solve(){
    int n;
    cin>>n;
    int ara[n];
    for(int i=0;i<n;i++) cin>>ara[i];
    int res = 0;
    for(int i=1;i<n;i++){
        if( ara[i] > ara[i-1]){
            res += ara[i] - ara[i-1];
            ara[i] = ara[i-1];
        }
    }
    cout<<res<<endl;

}
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    solve();
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3432kb

input:

3
100
150
200

output:

150

result:

ok single line: '150'

Test #2:

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

input:

2
5
4

output:

0

result:

ok single line: '0'

Test #3:

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

input:

4
10
0
9
8

output:

17

result:

ok single line: '17'

Test #4:

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

input:

5
11
9
5
5
12

output:

7

result:

ok single line: '7'

Test #5:

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

input:

7
104
98
93
91
100
95
93

output:

15

result:

ok single line: '15'

Test #6:

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

input:

10
88
93
93
87
114
107
110
110
94
85

output:

110

result:

ok single line: '110'

Test #7:

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

input:

60
233
214
172
241
168
169
187
215
248
157
222
220
166
236
213
164
235
167
195
217
150
153
184
213
245
219
175
230
183
157
225
205
212
215
237
164
207
197
203
183
218
232
163
206
204
195
199
226
163
173
230
221
170
249
168
168
180
220
179
208

output:

2610

result:

ok single line: '2610'

Test #8:

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

input:

100
286
254
291
265
330
273
281
331
346
279
288
347
339
279
327
251
321
293
337
335
333
257
258
301
346
270
337
264
329
256
346
330
258
315
335
309
300
324
250
286
337
271
326
304
292
335
327
261
348
283
307
336
330
310
256
342
310
342
340
331
299
295
284
261
305
322
269
328
293
321
333
342
276
329
...

output:

5110

result:

ok single line: '5110'

Test #9:

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

input:

1000
296
655
936
890
260
96
437
326
90
0
201
696
459
299
321
312
980
114
172
517
455
494
715
528
270
157
116
992
68
993
218
263
2
605
746
100
603
932
779
842
461
194
523
390
76
588
59
918
173
27
646
556
780
923
91
849
74
298
908
607
574
387
707
295
695
130
880
329
915
19
841
482
287
51
375
376
252
1...

output:

509686

result:

ok single line: '509686'

Test #10:

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

input:

1000
296
655
936
890
260
96
437
326
90
0
201
696
459
299
321
312
980
114
172
517
455
494
715
528
270
157
116
992
68
993
218
263
2
605
746
100
603
932
779
842
461
194
523
390
76
588
59
918
173
27
646
556
780
923
91
849
74
298
908
607
574
387
707
295
695
130
880
329
915
19
841
482
287
51
375
376
252
1...

output:

509686

result:

ok single line: '509686'

Test #11:

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

input:

1000
296
655
936
890
260
96
437
326
90
0
201
696
459
299
321
312
980
114
172
517
455
494
715
528
270
157
116
992
68
993
218
263
2
605
746
100
603
932
779
842
461
194
523
390
76
588
59
918
173
27
646
556
780
923
91
849
74
298
908
607
574
387
707
295
695
130
880
329
915
19
841
482
287
51
375
376
252
1...

output:

509686

result:

ok single line: '509686'

Test #12:

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

input:

5000
723
40
753
811
962
581
229
940
489
579
21
413
978
801
64
224
537
232
31
239
437
9
278
419
147
813
40
735
696
500
771
147
211
565
773
37
998
700
274
641
223
721
51
353
495
621
845
216
502
232
99
409
328
102
96
149
456
472
725
928
584
198
835
253
370
298
558
752
286
607
239
505
777
609
220
705
23...

output:

2485163

result:

ok single line: '2485163'

Test #13:

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

input:

5000
723
40
753
811
962
581
229
940
489
579
21
413
978
801
64
224
537
232
31
239
437
9
278
419
147
813
40
735
696
500
771
147
211
565
773
37
998
700
274
641
223
721
51
353
495
621
845
216
502
232
99
409
328
102
96
149
456
472
725
928
584
198
835
253
370
298
558
752
286
607
239
505
777
609
220
705
23...

output:

2485163

result:

ok single line: '2485163'

Test #14:

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

input:

10000
752
922
107
53
625
357
161
165
916
305
334
850
490
833
634
431
960
642
958
614
18
296
850
425
72
312
612
154
246
72
938
776
570
238
31
678
407
52
913
962
326
365
284
855
524
487
783
575
902
381
915
696
776
863
108
201
374
528
641
2
786
100
701
198
20
12
680
710
696
431
359
514
912
63
127
718
6...

output:

4986720

result:

ok single line: '4986720'

Test #15:

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

input:

10000
578
585
559
554
445
441
504
538
531
536
413
547
556
489
420
432
582
470
441
447
516
553
489
468
554
453
442
572
483
510
495
499
514
514
488
450
500
498
581
552
567
537
547
508
508
592
536
413
575
404
552
478
591
477
409
520
417
475
540
502
455
495
402
567
446
547
558
548
485
503
402
439
545
43...

output:

993869

result:

ok single line: '993869'

Test #16:

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

input:

10000
0
0
0
0
891
805
0
709
52
1000
51
1000
0
1000
1000
1000
1000
516
0
0
1000
0
0
149
1000
163
1000
0
0
1000
1000
0
1000
43
1000
0
1000
560
1000
219
94
113
0
1000
484
0
1000
0
896
220
1000
1000
1000
0
202
1000
1000
0
384
0
1000
0
853
907
1000
1000
0
1000
1000
0
1000
0
0
1000
784
1000
0
716
1000
100...

output:

4834842

result:

ok single line: '4834842'