QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#130867#1171. Integer Array ShuffledengtingyuWA 1ms3700kbC++14527b2023-07-25 14:59:212023-07-25 14:59:23

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-25 14:59:23]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3700kb
  • [2023-07-25 14:59:21]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100010
ll n;
ll a[N];
int main()
{
//	freopen("test1.in","r",stdin);
	//freopen(".in","r",stdin);
	//freopen("test1.out","w",stdout);
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	cin>>n;for(int i=1;i<=n;i++)cin>>a[i];
	ll ji=0,pre=0,ans=1;for(int i=1;i<=n;i++){
		if(ji==0&&a[i]>=pre){pre=a[i];continue;}
		if(ji==1&&a[i]<=pre){pre=a[i];continue;}
		ji^=1;pre=a[i-1];ans++;
	}cout<<(ll)ceil(log2(ans))<<'\n';
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
2 2 5

output:

0

result:

ok 1 number(s): "0"

Test #2:

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

input:

6
1 5 8 10 3 2

output:

1

result:

ok 1 number(s): "1"

Test #3:

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

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

input:

3
2 2 5

output:

0

result:

ok 1 number(s): "0"

Test #5:

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

input:

7
4 2 4 2 5 3 4

output:

2

result:

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