QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#727270#8040. Let Them Eat CakeArkhellAC ✓5ms4700kbC++14784b2024-11-09 12:22:432024-11-09 12:22:45

Judging History

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

  • [2024-11-09 12:22:45]
  • 评测
  • 测评结果:AC
  • 用时:5ms
  • 内存:4700kb
  • [2024-11-09 12:22:43]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
int n;
const int N=1e5+10;
int a[N];
int b[N];
void solve(){
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    int ans=0;
    int l=n;
    while(1){
        if(n==0){
            cout<<ans;
            return;
        }
        if(n==1){
            cout<<ans;
            return;
        }
        ans++;
        int l=1;
        for(int i=1;i<=n;i++){
            if(a[i]>a[i-1]&&a[i]>a[i+1]){
                b[l]=a[i];
                l++;
            }   
        }
        for(int i=1;i<l;i++){
            a[i]=b[i];
        }
        n=l-1;
    }


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

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
1 2 3 4 5

output:

1

result:

ok 1 number(s): "1"

Test #2:

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

input:

5
1 5 3 4 2

output:

2

result:

ok 1 number(s): "2"

Test #3:

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

input:

2
1 2

output:

1

result:

ok 1 number(s): "1"

Test #4:

score: 0
Accepted
time: 5ms
memory: 4428kb

input:

100000
100000 99999 99998 99997 99996 99995 99994 99993 99992 99991 99990 99989 99988 99987 99986 99985 99984 99983 99982 99981 99980 99979 99978 99977 99976 99975 99974 99973 99972 99971 99970 99969 99968 99967 99966 99965 99964 99963 99962 99961 99960 99959 99958 99957 99956 99955 99954 99953 9995...

output:

1

result:

ok 1 number(s): "1"

Test #5:

score: 0
Accepted
time: 3ms
memory: 4700kb

input:

100000
28708 58898 66379 81466 37843 38494 7200 13212 70705 98441 68380 79776 45228 18860 96220 19831 27343 59978 23624 87081 30257 26315 23862 7186 37684 193 70599 29284 14627 30319 51080 95350 17977 32253 58304 19841 67584 44345 69298 63002 48446 5959 8500 12298 59988 55130 56346 5380 23327 13969 ...

output:

11

result:

ok 1 number(s): "11"

Test #6:

score: 0
Accepted
time: 3ms
memory: 4668kb

input:

100000
72743 44886 88887 79534 73039 59668 25271 79700 79511 367 86467 30576 66004 39449 41715 4566 91620 76947 63324 90583 85057 86478 73270 85020 28824 27787 24887 1886 22406 74871 46760 36653 48917 12845 39253 48945 16711 32355 1799 30249 83263 24750 74089 94226 11670 71457 55091 2952 20006 73975...

output:

11

result:

ok 1 number(s): "11"

Test #7:

score: 0
Accepted
time: 5ms
memory: 4692kb

input:

100000
31628 44 67381 28236 32853 24077 80612 86645 35088 57122 15372 21707 3966 38717 87884 74738 52799 36501 64678 6205 33171 13185 50485 15888 91467 32344 9196 51541 2603 95686 13916 83347 94908 52434 71235 59263 30478 23262 79576 93981 77940 27266 36940 2663 36398 85275 86173 39906 99669 37727 2...

output:

10

result:

ok 1 number(s): "10"

Test #8:

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

input:

65535
32768 16384 49152 8192 40960 24576 57344 4096 36864 20480 53248 12288 45056 28672 61440 2048 34816 18432 51200 10240 43008 26624 59392 6144 38912 22528 55296 14336 47104 30720 63488 1024 33792 17408 50176 9216 41984 25600 58368 5120 37888 21504 54272 13312 46080 29696 62464 3072 35840 19456 52...

output:

16

result:

ok 1 number(s): "16"

Test #9:

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

input:

1
1

output:

0

result:

ok 1 number(s): "0"

Test #10:

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

input:

2
2 1

output:

1

result:

ok 1 number(s): "1"

Test #11:

score: 0
Accepted
time: 5ms
memory: 4492kb

input:

100000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

1

result:

ok 1 number(s): "1"

Extra Test:

score: 0
Extra Test Passed