QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#129112#1171. Integer Array ShufflezhangbeixiyanWA 22ms5028kbC++14526b2023-07-21 21:41:412023-07-21 21:41:44

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-21 21:41:44]
  • 评测
  • 测评结果:WA
  • 用时:22ms
  • 内存:5028kb
  • [2023-07-21 21:41:41]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

const int maxn=3e5+5;
int n,ans,a[maxn];
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	int toL=unique(a+1,a+n+1)-(a+1);
	int fl=0,ch=0;
	for(int i=2;i<=toL;i++) if(a[i]>a[i-1]) fl=1;
	if(!fl && toL!=1)
	{
		cout<<1<<endl;
		return 0;
	}
	int cur=0;
	for(int i=1;i<toL;i++) if(a[i]>a[i-1] && a[i]>a[i+1]) ans++;
	if(ans==0)
	{
		cout<<0<<endl;
		return 0;
	}
	if(a[n]>a[n-1]) ans++;
	cout<<ceil(log2(ans))+1<<endl;
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
2 2 5

output:

0

result:

ok 1 number(s): "0"

Test #2:

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

input:

6
1 5 8 10 3 2

output:

1

result:

ok 1 number(s): "1"

Test #3:

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

input:

8
14253630 18210471 431833031 681754868 791250850 811241570 837112104 858531105

output:

0

result:

ok 1 number(s): "0"

Test #4:

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

input:

3
2 2 5

output:

0

result:

ok 1 number(s): "0"

Test #5:

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

input:

7
4 2 4 2 5 3 4

output:

3

result:

ok 1 number(s): "3"

Test #6:

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

input:

8
92691902 57877007 167221695 197382747 709013587 643114183 962487887 112336349

output:

3

result:

ok 1 number(s): "3"

Test #7:

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

input:

8
14253630 811241570 18210471 431833031 858531105 837112104 681754868 791250850

output:

3

result:

ok 1 number(s): "3"

Test #8:

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

input:

8
1 1 1 1 1 1 1 1

output:

0

result:

ok 1 number(s): "0"

Test #9:

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

input:

8
858531105 837112104 811241570 791250850 681754868 431833031 18210471 14253630

output:

1

result:

ok 1 number(s): "1"

Test #10:

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

input:

8
1 2 2 2 2 1 1 1

output:

1

result:

ok 1 number(s): "1"

Test #11:

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

input:

2
802984614 842076689

output:

0

result:

ok 1 number(s): "0"

Test #12:

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

input:

8
3 2 8 5 3 3 7 2

output:

3

result:

ok 1 number(s): "3"

Test #13:

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

input:

8
534756887 390662306 218480651 10857063 92938437 247882342 648855863 554204660

output:

2

result:

ok 1 number(s): "2"

Test #14:

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

input:

3
2 1 1

output:

1

result:

ok 1 number(s): "1"

Test #15:

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

input:

8
2 3 1 5 6 2 1 7

output:

3

result:

ok 1 number(s): "3"

Test #16:

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

input:

8
2 4 1 3 4 1 3 4

output:

3

result:

ok 1 number(s): "3"

Test #17:

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

input:

6
2 5 7 11 5 2

output:

1

result:

ok 1 number(s): "1"

Test #18:

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

input:

8
18210471 811241570 858531105 837112104 791250850 681754868 431833031 49574517

output:

1

result:

ok 1 number(s): "1"

Test #19:

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

input:

8
961208043 796881752 487818469 31507809 253492364 77918871 600639171 333270504

output:

3

result:

ok 1 number(s): "3"

Test #20:

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

input:

8
3 2 3 3 1 3 2 3

output:

3

result:

ok 1 number(s): "3"

Test #21:

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

input:

7
1 2 3 3 3 1 3

output:

2

result:

ok 1 number(s): "2"

Test #22:

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

input:

10
10 10 8 7 6 5 4 3 2 1

output:

1

result:

ok 1 number(s): "1"

Test #23:

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

input:

10
1 2 3 4 5 6 7 8 10 10

output:

0

result:

ok 1 number(s): "0"

Test #24:

score: 0
Accepted
time: 14ms
memory: 4856kb

input:

277249
69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69 69...

output:

1

result:

ok 1 number(s): "1"

Test #25:

score: -100
Wrong Answer
time: 22ms
memory: 5028kb

input:

300000
999999998 999999998 999999998 999999998 999999998 999999998 999999998 999999998 999999998 999999998 999999998 999999998 999999998 999999998 999999998 999999998 999999998 999999998 999999998 999999998 999999998 999999998 999999998 999999998 999999998 999999998 999999998 999999998 999999998 999...

output:

1

result:

wrong answer 1st numbers differ - expected: '2', found: '1'