QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#317001 | #8040. Let Them Eat Cake | ship2077 | AC ✓ | 3ms | 4376kb | C++14 | 574b | 2024-01-28 11:06:09 | 2024-01-28 11:06:09 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
constexpr int M=1e5+5;
int n,m,Case,a[M],b[M];
int read(){
int x=0;char ch=getchar();
while (!isdigit(ch)) ch=getchar();
while (isdigit(ch)) x=x*10+ch-48,ch=getchar();
return x;
}
int main(){ n=read();
for (int i=1;i<=n;i++) a[i]=read();
while (n>1){
Case++;m=0;
for (int i=1;i<=n;i++)
if (a[i]>a[i-1]&&a[i]>a[i+1])
b[++m]=a[i];
for (int i=1;i<=m;i++) a[i]=b[i];
n=m;a[n+1]=0;
}
printf("%d\n",Case);
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3796kb
input:
5 1 2 3 4 5
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
5 1 5 3 4 2
output:
2
result:
ok 1 number(s): "2"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
2 1 2
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 2ms
memory: 4256kb
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: 0ms
memory: 4312kb
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: 4304kb
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: 0ms
memory: 4376kb
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: 0ms
memory: 4248kb
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: 3788kb
input:
1 1
output:
0
result:
ok 1 number(s): "0"
Test #10:
score: 0
Accepted
time: 0ms
memory: 3980kb
input:
2 2 1
output:
1
result:
ok 1 number(s): "1"
Test #11:
score: 0
Accepted
time: 2ms
memory: 4260kb
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