QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#129118#1171. Integer Array ShufflelikeblgWA 1ms3472kbC++14379b2023-07-21 22:03:092023-07-21 22:03:11

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 22:03:11]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3472kb
  • [2023-07-21 22:03:09]
  • 提交

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++;
	lg[1]=0;
	for(int i=2;i<=n;i++)lg[i]=lg[i/2]+1;
	cout<<lg[sum];
	return 0;
}

详细

Test #1:

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

input:

3
2 2 5

output:

0

result:

ok 1 number(s): "0"

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3472kb

input:

6
1 5 8 10 3 2

output:

0

result:

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