QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#129221#1171. Integer Array ShufflelikeblgWA 1ms5636kbC++14398b2023-07-22 07:42:592023-07-22 07:43:02

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-22 07:43:02]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5636kb
  • [2023-07-22 07:42:59]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int const N=3e5+10;
int n,flag,sum;
int a[N],lg[N];
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		if(!flag){
			if(a[i]<a[i-1]){
				sum++;
				flag=1;
			}
		}
		else{
			if(a[i]>a[i-1])flag=0;
		}
	}
	if(!flag&&sum)sum++;
	lg[0]=-1;
	lg[1]=0;
	for(int i=2;i<=n;i++)lg[i]=lg[i/2]+1;
	cout<<lg[sum]+1;
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
2 2 5

output:

0

result:

ok 1 number(s): "0"

Test #2:

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

input:

6
1 5 8 10 3 2

output:

1

result:

ok 1 number(s): "1"

Test #3:

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

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: 3476kb

input:

3
2 2 5

output:

0

result:

ok 1 number(s): "0"

Test #5:

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

input:

7
4 2 4 2 5 3 4

output:

3

result:

ok 1 number(s): "3"

Test #6:

score: -100
Wrong Answer
time: 0ms
memory: 3452kb

input:

8
92691902 57877007 167221695 197382747 709013587 643114183 962487887 112336349

output:

2

result:

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